I want to store an image from PC to ms sql db , I want the details of the coding from the first step. From getting the image to converting to bytes and then storing, Can anyone please provide me the coding part of it..
Storing of image in DB using open file dialog box
Collapse
X
-
Tags: None
-
-
Hi , thanks. But can i get the c # coding..
And also If storing in Db is overload , Then which is the best way to do it.Comment
-
First, I'm not going to convert the code to C# for you, you will learn nothing.
Best way, if this is an ASP.NET application then store the images in a folder and the path to the image in your database.Comment
-
-
RAJASEKAR S,I too came across this issue and got it resolved in the following way
1.datatype of the image column-image
2.in aspx.cs page
HttpPostedFile uploadedImage=n ull;
byte[] imageData=null;
if (cmdBrowsePhoto .PostedFile != null)
{
imageData = new byte[cmdBrowsePhoto. PostedFile.Cont entLength];
uploadedImage = cmdBrowsePhoto. PostedFile;
uploadedImage.I nputStream.Read (imageData, 0, (int)cmdBrowseP hoto.PostedFile .ContentLength) ;
}
cmd.Parameters. Add(new SqlParameter("@ photo", imageData));Comment
Comment