在数据库中插入图片

时间:2016-06-17 10:13:46

标签: c# database image insert

Image img =fromcomputer.Image;
byte[] arr;
ImageConverter converter = new ImageConverter();
arr = (byte[])converter.ConvertTo(img, typeof(byte[]));

string uploadpic = "insert into mypic(Data) values('" + arr + "',"  + "@Image)";
MySqlExtended.dbaccess.f_exec_string(uploadpic, connString);
MySqlConnection conn = new MySqlConnection(connString);
MySqlCommand command = conn.CreateCommand();
command.Parameters.Add(new MySqlParameter("@Image", fromcomputer));

0 个答案:

没有答案