日期:2014-05-18  浏览次数:20766 次

上传图片的问题,在线等
C# code

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附近有错误

------解决方案--------------------
employeeID是什么类型的?不是数字要加''

另外,一般插入是不要where条件的