这是我的代码,我希望显示存储在sql中的图像到水晶报告,请有人帮帮我:))
private void button2_Click(object sender, EventArgs e)
{
string connectionstring = null;
SqlConnection conn;
connectionstring="Server=AJITHBABU\\SQLEXPRESS;Initial Catalog=temprorary;User ID=sa;Password=2604";
conn=new SqlConnection(connectionstring);
byte[] img = null;
FileStream fs = new FileStream(imgloc, FileMode.Open, FileAccess.Read);
BinaryReader br = new BinaryReader(fs);
img = br.ReadBytes((int)fs.Length);
k = "INSERT INTO temprorary4(id,img)values('" + textBox1.Text + "',@img)";
conn.Open();
cmd = new SqlCommand(k, conn);
cmd.Parameters.Add(new SqlParameter("@img",img));
int x=cmd.ExecuteNonQuery();
conn.Close();
MessageBox.Show(x.ToString() +"record(s) saved");
}