| | |
saving a file to database
Please support our C# advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: May 2009
Posts: 11
Reputation:
Solved Threads: 2
•
•
•
•
Welcome nverma.
What do you mean by saving a file in a database?
Show us the code you already have. And if you do so PLEASE use code tags.
string con = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:/C1/App_Data/db4.mdb;Persist Security Info=False";
string q="insert into table(fname,fcontent) values('"+this.FileUpload.Text+"','"+this.FileUpload.Content+"');
OleDbConnection cn = new OleDbConnection(con);
cn.Open();
OleDbCommand cmd = new OleDbCommand(q, cn);
cmd.ExecuteNonQuery();
cn.Close();
Last edited by nverma; Jul 25th, 2009 at 8:41 am.
Use parameterized query. fcontent field type must be binary (blob/image) ole or something with access db.
c# Syntax (Toggle Plain Text)
string con = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:/C1/App_Data/db4.mdb;Persist Security Info=False"; string q="insert into table(fname,fcontent) values(?,?)" ...
Failure is not fatal, but failure to change might be. - John Wooden
![]() |
Similar Threads
- How to save a file in database and get the content from that file(using java) (Java)
- how to upload a doc file into database (ASP.NET)
- While I am Downloading ,One Dialogbox will open.When user will be saving file name... (ASP.NET)
- save file to database (Java)
- Storing Text file in Database through VB (Visual Basic 4 / 5 / 6)
- Saving Images In Database (VB.NET)
- Saving a file using C++ (C++)
Other Threads in the C# Forum
- Previous Thread: Label problem
- Next Thread: C# and USB
| Thread Tools | Search this Thread |
.net access algorithm api array barchart bitmap box broadcast buttons c# check checkbox client combobox control conversion csharp custom database datagrid datagridview dataset datetime decryption degrees development draganddrop drawing encryption enum event excel file form format forms function gdi+ grantorrevokepermissionthroughc#.net httpwebrequest image index input install java label list listbox mandelbrot marshalbyrefobject math mouseclick mysql netcfsvcutil.exe numeric operator path photoshop php picturebox pixelinversion platform polynomial post programming properties radians regex registry remote remoting richtextbox server sleep socket sql statistics stream string study sun table teamsuite text textbox thread time timer update usb usercontrol validation visualstudio webbrowser windows winforms wpf wpfc# xml






