Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General MS InfoPath Questions / February 2006

Tip: Looking for answers? Try searching our database.

Attachments & SQL Database

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Colin - 01 Feb 2006 21:26 GMT
Hello,

I have a form that I have designed to submit to an SQL Database.  What I
would like to know is, is there anyway to attach a file (such as a word doc,
or text file) to the form and have that document save to the SQL Database
when the user clicks submit?
Sandeep - 02 Feb 2006 15:29 GMT
Hi Colin

This code writen in c# code

string connStr ="server=Your system number;" + "integrated security=SSPI;" +
"database= Your database name";
byte []buffer =
Encoding.Unicode.GetBytes(thisXDocument.DOM.selectSingleNode("/my:myFields/my:field4").text);

SqlConnection conn = new SqlConnection(connStr);
string insert= "insert into employee2 values (@id,@photo)";
SqlCommand cmd=new SqlCommand (insert,conn);
cmd.Parameters.Add(new SqlParameter("@id", SqlDbType.Char)).Value =
thisXDocument.DOM.selectSingleNode("/my:myFields/my:field1").text;
cmd.Parameters.Add(new SqlParameter("@photo",SqlDbType.Image)).Value = buffer;
conn.Open ();
cmd.ExecuteNonQuery ();
conn.Close ();

I hopr this will help U
Signature

Sandeep
www.autonomysystems.com

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.