i am making a website on online shopping using asp.net and sql server 2008...
now i am creating the database for it where i have started making the
first table as item_details which has a column as item_image where i
need to store the image url..so how can i do this please help....
Image url in sql server 2008
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Sandeep Singh ShekhawatRank #147 · 15.6K reputationPosted May 19, 2013, 11:36 PM EDT
You are using fileupload control then do
if (FileUpload1.HasFile)
{
//Get file name
string filename = System.IO.Path.GetFileName(FileUpload1.FileName);
//get full server file path with name where we save file
string filePath = Server.MapPath("~//" + filename);
//Save/upload file on server
FileUpload1.SaveAs(filePath);
//Here you can pass filePath variable to database that contains full file path means full url like
SqlConnection con =new SqlConnection(connesctionString);
cmd.ExecuteNonQuery();
}
Pankaj PandeyRank #642 · 3.7K reputationPosted May 20, 2013, 12:35 AM EDT
string Filename = FileUpload1.FileName;
string FilePath = Server.MapPath("~//" + Filename);
FileUpload1.SaveAs(FilePath);
Now you can store FilePath to your table and use it as your need.
Mark answered if usefull.
thanks