Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
|
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 8th, 2004, 07:37 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
Send a message via Yahoo to melvik
Default 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>.

Always:),
Hovik Melkomian.
__________________
Always,
Hovik Melkomian.
 
Old November 21st, 2005, 04:05 AM
Registered User
 
Join Date: Nov 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

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

Regards
Andi

 
Old November 21st, 2005, 01:40 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

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

 
Old November 22nd, 2005, 03:57 PM
SQLScott's Avatar
Wrox Author
 
Join Date: Dec 2004
Posts: 338
Thanks: 0
Thanked 2 Times in 2 Posts
Default

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");
try
{
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 ();


 
Old November 28th, 2005, 09:12 AM
Registered User
 
Join Date: Nov 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks. It works.

Andi






Similar Threads
Thread Thread Starter Forum Replies Last Post
Updating database & saving it to another file OnceANewbie VB Databases Basics 1 December 1st, 2008 06:58 AM
How to store MS Word File in database kesar SQL Language 2 March 1st, 2007 06:34 AM
Saving/Retrieving Image file to Database davekrunal46 VB How-To 6 January 11th, 2006 04:41 AM
Saving Word File In SQL Server abdul_wasie Classic ASP Databases 0 May 20th, 2005 06:05 AM
Saving Word file into Database melvik C# 0 March 8th, 2004 07:36 AM





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