0
Finally I got the correct code:-
int length = flUpldCoverPhoto.PostedFile.ContentLength;
byte[] photo_aray = new byte[length]; HttpPostedFile postedFile = flUpldCoverPhoto.PostedFile; postedFile.InputStream.Read(photo_aray, 0, length); sqlCon.Open(); SqlCommand cmd = new SqlCommand("SaveBookDetails", sqlCon); cmd.Parameters.Add("@asBookName", SqlDbType.VarChar).Value = txtBookName.Text; cmd.Parameters.Add("@asBookPhoto", SqlDbType.Image).Value = photo_aray; cmd.Parameters.Add("@asBookPrice", SqlDbType.Float).Value = txtBookPrice.Text.ToString(); cmd.Parameters.Add("@asAuthor", SqlDbType.VarChar).Value = txtBookAuthor.Text; cmd.Parameters.Add("@asPublishedYear", SqlDbType.VarChar).Value = txtPublishYear.Text; cmd.CommandType = CommandType.StoredProcedure; int inCount = cmd.ExecuteNonQuery(); 0
hi,
I am in the edge of getting the result in insert function, so I only need the solution for Failed to convert parameter value from a String to a Byte[].
the link you gave is totally different from my program flow.
0
Hi ,
check this
http://www.aspsnippets.com/Articles/How-to-save-insert-Image-in-Database-in-ASPNet-using-C-and-VBNet.aspx
0
Check this
http://www.c-sharpcorner.com/uploadfile/e628d9/inserting-retrieving-images-from-sql-server-database-without-using-stored-procedures/