从数据库中读取图片的问题
C#从数据库读图片的问题我以sqlserver2K中northwind数据库中categories表为例对里面的图片读取,但运行不能读出来.
protected void Button3_Click(object sender, EventArgs e)
{
SqlConnection connection = new SqlConnection("server=(local);database=northwind;user id=sa;pwd=");
connection.Open();
SqlCommand comm = new SqlCommand("select * from categories", connection);
SqlDataReader reader = comm.ExecuteReader();
while (reader.Read())
{
Response.ContentType ="image/jpeg";
Response.BinaryWrite((byte[])reader["Picture"]);
}
}