c# 读取图片参数无效
SqlConnectionsc=newSqlConnection("DataSource=PC-20101117ODAA\\SQLEXPRESS;DataBase=LiX...
SqlConnection sc = new SqlConnection("Data Source=PC-20101117ODAA\\SQLEXPRESS;DataBase=LiXiKS;pwd=sa;uid=sa");
sc.Open();
if (sc.State == ConnectionState.Open)
{
MessageBox.Show("ok");
}
else
{
MessageBox.Show("NO");
}
SqlCommand scd = new SqlCommand("select pic from StudentName where nostudent='"+this.label1.Text+"'",sc);
byte[] bytt = (byte[])scd.ExecuteScalar();
MemoryStream ms = new MemoryStream(bytt);
this.pictureBox1.Image = Image.FromStream(ms);
VS提示我ms参数无效,数据库里存有二进制图片呀 展开
sc.Open();
if (sc.State == ConnectionState.Open)
{
MessageBox.Show("ok");
}
else
{
MessageBox.Show("NO");
}
SqlCommand scd = new SqlCommand("select pic from StudentName where nostudent='"+this.label1.Text+"'",sc);
byte[] bytt = (byte[])scd.ExecuteScalar();
MemoryStream ms = new MemoryStream(bytt);
this.pictureBox1.Image = Image.FromStream(ms);
VS提示我ms参数无效,数据库里存有二进制图片呀 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询