首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

上传图片的有关问题

2012-03-31 
上传图片的问题,在线等C# codeusing (SqlConnection con new SqlConnection(connect.conn)){FileStream

上传图片的问题,在线等

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条件的

热点排行