Dear all,
I would like to update an image field on sql server with a stored procedure "INSERTIMG" which receives one parameter varbinary(16).
So i am reading a picture file i am storing it in a byte[] array "bts" and i want all the byte array become the parameter value for stored procedure "INSERTIMG".
But during the execution i am receiving the error:
"Procedures INSERTIMG expects parameter @img which was not supplied".
Why the data of bts array doesn't supply the parameter of stored procedure?
Many thanks
FileStream str=new FileStream(@"c:\temp1.jpg",FileMode.Open ,FileAccess.Read);
byte[] bts=new byte[str.Length-1];
str.Read(bts,0,bts.Length-1);
str.Close();
OleDbCommand cmd=new OleDbCommand();
cmd.CommandText="INSERTIMG";
cmd.Parameters.Add("@img",textdata);
try
{
cmd.ExecuteNonQuery();
}
catch(System.Exception ex)
{
MessageBox.Show(ex.Message);
}
I would like to update an image field on sql server with a stored procedure "INSERTIMG" which receives one parameter varbinary(16).
So i am reading a picture file i am storing it in a byte[] array "bts" and i want all the byte array become the parameter value for stored procedure "INSERTIMG".
But during the execution i am receiving the error:
"Procedures INSERTIMG expects parameter @img which was not supplied".
Why the data of bts array doesn't supply the parameter of stored procedure?
Many thanks
FileStream str=new FileStream(@"c:\temp1.jpg",FileMode.Open ,FileAccess.Read);
byte[] bts=new byte[str.Length-1];
str.Read(bts,0,bts.Length-1);
str.Close();
OleDbCommand cmd=new OleDbCommand();
cmd.CommandText="INSERTIMG";
cmd.Parameters.Add("@img",textdata);
try
{
cmd.ExecuteNonQuery();
}
catch(System.Exception ex)
{
MessageBox.Show(ex.Message);
}