Problem with Inserting an image into a sql 2000 database
Posted on 2004-09-30
I am having a ton of trouble trying to get this piece of code to work correctly, can someone please tell me what's being done wrong here?
Thank you very much.
public void InsertImage(MemoryStream MemImg)
long ImgLen = MemImg.Length;
byte  ByteImg;
ByteImage = new byte [ImgLen -1];
MemImg.Position = 0;
MemImg.Read(ByteImg, 0, (int)(ImgLen - 1));
//...sql objects declared here...
string strSql = "INSERT INTO Customers (FName, LName, Pic) VALUES ('" + txtFName.Text + "'," + "'" + txtLName.Text + "'," + ByteImg + ")";
mycmd = new SqlCommand(strSql, Conn);