Click here to Skip to main content
15,898,222 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Dear All,

I am trying to connect to mysql database.I am able to fetch the records from a table but the field type tinyint(1) convert to square box in front end. Mysql database is a shared database with 10000+ tables And have no authority to modify it. so need a generic solution to display.I tried a lot but nothing works for me. Below is the code and database entry.
Code:
MySqlConnection conn = new MySqlConnection(mysqlstring);
conn.Open();
MySqlCommand cmd = conn.CreateCommand();
cmd.CommandText = "SELECT * FROM avg_product";
MySqlDataAdapter adap = new MySqlDataAdapter(cmd);
DataSet ds = new DataSet();
adap.Fill(ds);
GridView2.DataSource = ds.Tables[0].DefaultView;
GridView2.DataBind();


database:
field has values as 0 or 1.
Dataset Visualizer in visual studio showing as TRUE/FALSE.On front end in browser,Gridview shows a square box(kind of checkbox).

Please help me. Thanks in advance.
Posted

1 solution

just cast the value as

select cast(tinyintcol as int) , from tbl

this should work
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900