Medium Blob in DataGrid ASP.net C#
I am currently trying to display data from a table in a MySQL Database using a DataGrid component in ASP.net C#.
Its displaying all of the columns which are in int and varchar format but one column is a mediumblob format which contains only text.
I am binding the DataGrid to a DataSet from the MySQL table using the following
public void loadGrid(string query, GridView tblGrid)
{
using (DatabaseWork db = new DatabaseWork())
{
using (MySqlCommand cmd = new MySqlCommand(query, db.conn))
{
using (MySqlDataAdapter da = new MySqlDataAdapter(cmd))
{
DataSet ds =开发者_开发技巧 new DataSet();
da.Fill(ds);
tblGrid.DataSource = ds.Tables[0];
tblGrid.DataBind();
}
}
}
For some reason the Medium blob is never being shown and no exception is being thrown.
Thanks for any help you can offer.
You'll need to process the BLOB first. For a bit of help, have a look here: http://dev.mysql.com/doc/refman/5.0/en/connector-net-programming-blob.html
@Francis Gilbert. Looking at the post I thought it would make more sense as I am only going to be storing text in the field is to the field TINYTEXT instead of TINYBLOB. Doing this fixes the datagrid.
精彩评论