Click here to Skip to main content
12,633,764 members (30,930 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: ASP.NET
program for inserting a word file content in sql server 2005 database
Posted 24-Jan-13 23:58pm
jalbaji612
Comments
Rahul Dhoble 25-Jan-13 5:14am
   
Hello jalbaji ,
As this member suggested answer for your question which is correct . Please accept his solution, vote it and mark your question as 'SOLVED'

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Try:
byte[] data = File.ReadAllBytes(pathToFile);
            using (SqlConnection con = new SqlConnection(strConnect))
                {
                con.Open();
                using (SqlCommand com = new SqlCommand("INSERT INTO myTable (myColumn) VALUES (@C1)", con))
                    {
                    com.Parameters.AddWithValue("@C1", data);
                    com.ExecuteNonQuery();
                    }
                }
  Permalink  
Comments
Rahul Dhoble 25-Jan-13 5:13am
   
Good answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.161208.2 | Last Updated 25 Jan 2013
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100