DataGrid ASP.net C# 中的中型 Blob
我目前正在尝试使用 ASP.net C# 中的 DataGrid 组件显示 MySQL 数据库中表中的数据。
它显示所有 int 和 varchar 格式的列,但有一列是仅包含文本的mediumblob 格式。
我使用以下命令将 DataGrid 绑定到 MySQL 表中的 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();
}
}
}
由于某种原因,Medium blob 永远不会显示,也不会引发异常。
感谢您提供的任何帮助。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要首先处理 BLOB。如需帮助,请查看此处:
http://dev.mysql.com/doc /refman/5.0/en/connector-net-programming-blob.html
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
@弗朗西斯·吉尔伯特。看着这篇文章,我认为这更有意义,因为我只会将文本存储在 TINYTEXT 字段而不是 TINYBLOB 字段中。这样做可以修复数据网格。
@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.