简体   繁体   English

DataGrid ASP.net C#中的中等Blob

[英]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#. 我目前正在尝试使用ASP.net C#中的DataGrid组件从MySQL数据库中的表显示数据。

Its displaying all of the columns which are in int and varchar format but one column is a mediumblob format which contains only text. 它显示所有以int和varchar格式显示的列,但其中一列是中点格式,仅包含文本。

I am binding the DataGrid to a DataSet from the MySQL table using the following 我使用以下方法将MySQL表格中的DataGrid绑定到DataSet

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. 出于某种原因,从不显示Medium Blob,也不会引发异常。

Thanks for any help you can offer. 谢谢你的尽心帮助。

You'll need to process the BLOB first. 您需要先处理BLOB。 For a bit of help, have a look here: http://dev.mysql.com/doc/refman/5.0/en/connector-net-programming-blob.html 要获得帮助,请在此处查看: http : //dev.mysql.com/doc/refman/5.0/en/connector-net-programming-blob.html

@Francis Gilbert. @弗朗西斯·吉尔伯特(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. 看一下帖子,我认为这会更有意义,因为我仅将文本存储在字段TINYTEXT而不是TINYBLOB中。 Doing this fixes the datagrid. 这样做可以修复数据网格。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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