I am trying to insert image in my databse .However I dont want to use the parameters as my set up of coding pattern does not allow this.Is there a way out?
I know that following code inserts the image
byte[] imageData = ReadFile(txtImagePath.Text);
SqlConnection CN = new SqlConnection(txtConnectionString.Text);
string qry = "insert into ImagesStore (ImageData) values( @ImageData)";
SqlCommand SqlCom = new SqlCommand(qry, CN);
SqlCom.Parameters.Add(new SqlParameter("@ImageData", (object)imageData));
//Open connection and execute insert query.
CN.Open();
SqlCom.ExecuteNonQuery();
CN.Close();
But However, I would like to use some thing like this without the SQL Parameters
byte[] imageData = ReadFile(txtImagePath.Text);
SqlConnection CN = new SqlConnection(txtConnectionString.Text);
string qry = "insert into ImagesStore (ImageData) values(IMAGE DATA IN SOME FORM MAY BE 0101000101011001100 I dont know!)";
SqlCommand SqlCom = new SqlCommand(qry, CN);
//Open connection and execute insert query.
CN.Open();
SqlCom.ExecuteNonQuery();
CN.Close();