save my videofile's path onto a database on using the "FileUpload"

Posted by Shreesh under ASP.NET on 10/5/2011 | Points: 10 | Views : 2376 | Status : [Member] | Replies : 1
i'm trying to play videos in the gridview,and i need to save my videofile's path onto a database on using the "FileUpload" control,so that i can retrieve it on the gridview to play those videos. i have managed to upload the file,but i am not sure how to the save file path. i'd appreciate it if you could help me with this.thanks in advance.


Posted by: Ndebata on: 10/5/2011 [Member] Starter | Points: 25

Hi Sreesh,

When you are uploading videos using the file upload control , your are saving those in a location by providing the path.
You need to save that path (string)

using (System.Data.SqlClient.SqlConnection con = new System.Data.SqlClient.SqlConnection("<your db connection string>"))

using (System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand())
cmd.Connection = con;
cmd.CommandText = @"INSERT INTO TABLE_XYZ(VideoPath) VALUES(@Path)";
cmd.CommandType = CommandType.Text;

cmd.Parameters.AddWithValue("@Path", "<The saving path of file from file upload control>");


Shreesh, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response