hi friends,
i want to store an image in DB. but most of my friends told that, to store an image in web server then store tat location in a DB and access it anywhere. this is for asp.net in C#-code behind. how to do this? i've a table with a text field. then ......? waiting for ur reply.........
note: i need coding. not by using controls. pls...
Hi,
if you want store the image on DB, you can pass it asSqlDbType.Image, and assign a byte array to the field to be saved.
cmd.Parameters.Add("@.Image",SqlDbType.Image, 0,"Image_Data");
DataRow row = new ...
row.Image_Data =File.ReadAllBytes(pathToFile); //assuming you uploaded it and saved it somewhere.
//your update command
Hope this help
No comments:
Post a Comment