p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   SQL Server 2000 (http://p2p.wrox.com/forumdisplay.php?f=20)
-   -   Saving Word file into Database (http://p2p.wrox.com/showthread.php?t=10219)

melvik March 8th, 2004 07:37 AM

Saving Word file into Database
Hi there:
I wanna save MS-Office Word file into MS-SQL Server 2000 (file contents) using C#.
Can anyone help me. Any idea or sample will be appreciated & [u]unforgettable</u>.

Hovik Melkomian.

andS November 21st, 2005 04:05 AM


do you have found a solution?
I'm very intresting in it...


jbenson001 November 21st, 2005 01:40 PM

Post this question in one of the ASP.NET forums..

SQLScott November 22nd, 2005 03:57 PM

Use a byte array. The following example illustrates:

int len = Upload.PostedFile.ContentLength;
byte[] pic = new byte[len];
Upload.PostedFile.InputStream.Read (pic, 0, len);
// Insert the image and comment into the database
SqlConnection connection = new SqlConnection _ (@"server=Servername;database=databasename;uid=sa;pwd=password");
connection.Open ();

SqlCommand cmd = new SqlCommand ("insert into Image " + "(Picture, Comment) values (@pic, @text)", connection);

cmd.Parameters.Add ("@pic", pic);
cmd.Parameters.Add ("@text", Comment.Text);
cmd.ExecuteNonQuery ();

andS November 28th, 2005 09:12 AM

Thanks. It works.


All times are GMT -4. The time now is 03:11 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.