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.
解决方案just cast the value as
select cast(tinyintcol as int) , from tbl
this should work