我有一个图片表,它有以下列:
PICTURE_ID int IDENTITY(1000,1) NOT NULL,
CATEGORY_ID int NOT NULL,
IMGDATA image NOT NULL,
CAPTION1 text COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
MIME_TYPE nchar(20) NOT NULL DEFAULT ('image/jpeg'),
IMGTHDATA image NOT NULL
在我的代码背后,我有:
string tableName = "CATPICS";
SqlConnection dbConnection = new SqlConnection(connStr);
SqlDataAdapter daCatPics = new SqlDataAdapter("SELECT TOP(3) * FROM CATEGORY_PICTURES", dbConnection);
DataSet dsPics = new DataSet();
daCatPics.Fill(dsPics, tableName);
gvCatPics.DataSource = dsPics;
gvCatPics.DataMember = tableName;
gvCatPics.DataBind();
在标记上,我几乎有:
<asp:GridView ID="gvCatPics" runat="server"></asp:GridView>
但是,当代码执行时,它只忽略两个图像列(imgdata和imgthdata)。由于某些原因,它无法识别它们是图像列。有人知道让它渲染图像的最简单方法吗?