how to download a file through sqlserver database using asp c#

Posted by Amar888 under Regular Expressions on 2/22/2010 | Views : 3029 | Status : [Member] | Replies : 3
hi,
i created database tables in sqlserver regarding upload a file its working but now i want how to down load a file through database . i was use grid view also when i upload a file it shows through gridview and if we want to delete just click delete symbol. so, any one can under stand pls send me solution.

protected void Button1_Click(object sender, EventArgs e)
{
if (FileUpload1.HasFile)
{
// delete and content with the same name
ContentDataSource.Insert();
// insert new content
ContentDataSource.Delete();
// refresh the content list
GridView1.DataBind();
}
}



protected void ContentDataSource_Inserting(object sender, SqlDataSourceCommandEventArgs e)
{
e.Command.Parameters["@name"].Value = FileUpload1.FileName;
e.Command.Parameters["@type"].Value = FileUpload1.PostedFile.ContentType;
e.Command.Parameters["@length"].Value = FileUpload1.PostedFile.ContentLength;
e.Command.Parameters["@img"].Value = FileUpload1.FileBytes;
}


protected void ContentDataSource_Deleting(object sender, SqlDataSourceCommandEventArgs e)
{
e.Command.Parameters["@name"].Value = FileUpload1.FileName;

}





Responses

Posted by: Vuyiswamb on: 2/22/2010 [Member] [MVP] [Administrator] NotApplicable

Up
0
Down
ok , Your Questions is a bit confusing

Amar888 wrote :
i created database tables in sqlserver regarding upload a file its working but now i want how to download a file through database .

I don't understand what you are trying to say here.

Amar888 wrote :

i was use grid view also when i upload a file it shows through gridview and if we want to delete just click delete symbol. so, any one can under stand pls send me solution.

here is assume you want to have an entry on the database when a file has been uploaded. but you want to keep your uploaded files on the file system somewhere in the folder. if that is correct tell us.

Thank you for posting at Dotnetfunda

Vuyiswa Maseko

Thank you for posting at Dotnetfunda
[Administrator]

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

Posted by: Amar888 on: 2/22/2010 [Member] Starter

Up
0
Down
i created one text box , browse button and upload button .
if i click browse button the window will open select a particular file or image and just press upload button it will stores my database table. now i want to download a file or image through my database table wher i can upload .


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

Posted by: Vuyiswamb on: 2/22/2010 [Member] [MVP] [Administrator] NotApplicable

Up
0
Down
So you want to store the file you want to Upload in the Database and keep the Record of it and in the grid be able to delete the Uploaded file ?



Thank you for posting at Dotnetfunda
[Administrator]

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

Login to post response