如下图程序 我运行到这里时可以截图 并且能够保存早debug中 但当我调试到吧图片转换为二进制流是就出错
错误是找不到这个问件 但我去debug 中看是有这个文件的啊
private void buttonSnap_Click(object sender, EventArgs e)
{
if(textBoxSnapAddrs.Text != null)
{
camera.snapPath = textBoxSnapAddrs.Text + @".bmp";
camera.GrabImage();
FileStream fs = new FileStream(@"textBoxSnapAddrs.Text.bmp", FileMode.Open);
Byte[] by = new byte[fs.Length];
fs.Read(by, 0, Convert.ToInt32(fs.Length));
fs.Close();
using (SqlConnection conn = new SqlConnection(con))
{
conn.Open();
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandText = "insert into patient(p_image) values(@textBoxSnapAddrs.Text.bmp)";
SqlParameter par = new SqlParameter("@textBoxSnapAddrs.Text.bmp", SqlDbType.Image);
par.Value = by;
cmd.Parameters.Add(par);
int t = (int)(cmd.ExecuteNonQuery());
conn.Close();
}
MessageBox.Show("保存成功!");
求大神解答 我刚刚学c# 好多东西不太懂