using (SqlConnection con = new SqlConnection(connect.conn))
{
FileStream fs = new FileStream(connect.picpath,FileMode.Open,FileAccess.Read);
byte[] imagebytes = new byte[fs.Length];
BinaryReader br = new BinaryReader(fs);
imagebytes = br.ReadBytes(Convert.ToInt32(fs.Length));
con.Open();
SqlCommand com = new SqlCommand("insert into employees(photo) values(@image) where employeeID="+this.textBox6.Text,con);
SqlParameter image = new SqlParameter("@image",SqlDbType.Image);
image.Value = imagebytes;
com.Parameters.Add(image);
com.ExecuteNonQuery();
}提示WHERE附近有错误
FileStream fs = new FileStream(connect.picpath,FileMode.Open,FileAccess.Read);
byte[] imagebytes = new byte[fs.Length];
BinaryReader br = new BinaryReader(fs);
imagebytes = br.ReadBytes(Convert.ToInt32(fs.Length));
con.Open();
SqlCommand com = new SqlCommand("insert into employees(photo) values(@image) where [email protected]",con);
com.Parameters.AddWithValue("@image", imagebytes);
com.Parameters.AddWithValue("@employeeID", this.textBox6.Text);
com.ExecuteNonQuery();还是where错误
谁告诉你这么写的???
"insert into employees(photo) values(@image) where employeeID=@employeeID"
不是
"insert into employees(photo) values(@image) where [email protected]"
你是更新吧,你写成插入了