Click here to Skip to main content
11,490,003 members (63,691 online)
Rate this: bad
good
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
jalbaji591
Comments
Rahul Dhoble at 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 at 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
0 Sergey Alexandrovich Kryukov 595
1 Andy Lanng 233
2 OriginalGriff 213
3 Maciej Los 170
4 _duDE_ 141
0 Sergey Alexandrovich Kryukov 9,608
1 OriginalGriff 8,475
2 Sascha Lefèvre 3,419
3 Maciej Los 3,106
4 Richard Deeming 2,370


Advertise | Privacy | Mobile
Web04 | 2.8.150520.1 | Last Updated 25 Jan 2013
Copyright © CodeProject, 1999-2015
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