简体   繁体   中英

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM