Click here to Skip to main content
15,889,909 members
Home / Discussions / C#
   

C#

 
GeneralRe: Detect scroll to end of document in a webbrowser control Pin
Chris Quinn28-Jun-10 4:30
Chris Quinn28-Jun-10 4:30 
GeneralRe: Detect scroll to end of document in a webbrowser control Pin
Chris Quinn28-Jun-10 23:23
Chris Quinn28-Jun-10 23:23 
Questiondo anyone have codes for sql 2005 for saving picture? Pin
ronakT23-Jun-10 21:59
ronakT23-Jun-10 21:59 
AnswerRe: do anyone have codes for sql 2005 for saving picture? Pin
Pete O'Hanlon23-Jun-10 22:12
mvePete O'Hanlon23-Jun-10 22:12 
GeneralRe: do anyone have codes for sql 2005 for saving picture? Pin
Luc Pattyn24-Jun-10 3:35
sitebuilderLuc Pattyn24-Jun-10 3:35 
GeneralRe: do anyone have codes for sql 2005 for saving picture? Pin
Pete O'Hanlon24-Jun-10 3:49
mvePete O'Hanlon24-Jun-10 3:49 
GeneralRe: do anyone have codes for sql 2005 for saving picture? Pin
Luc Pattyn24-Jun-10 3:57
sitebuilderLuc Pattyn24-Jun-10 3:57 
AnswerRe: do anyone have codes for sql 2005 for saving picture? [modified] Pin
Luc Pattyn24-Jun-10 4:05
sitebuilderLuc Pattyn24-Jun-10 4:05 
Based on what Pete already offered, I would try this:

private void SaveImageToDb(string fileName, SqlConnection sqlConnection)
{
    using (SqlCommand sqlCmd = new SqlCommand( 
      "INSERT INTO MyTable(MyImage) VALUES (@Image)", sqlConnection ))
    {
        sqlCmd.Parameters.Add( "@Image", SqlDbType.VarBinary);
        sqlCmd.Parameters [ "@Image" ].Value = File.ReadAllBytes(fileName);
        sqlCmd.ExecuteNonQuery( );
    }
  }
}


Warning: MSDN on SqlDbType.VarBinary holds a comment on size; something happens around 8000 bytes!

Smile | :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use < PRE > tags for code snippets, it preserves indentation, and improves readability.


modified on Thursday, June 24, 2010 10:58 AM

GeneralRe: do anyone have codes for sql 2005 for saving picture? Pin
Pete O'Hanlon24-Jun-10 4:21
mvePete O'Hanlon24-Jun-10 4:21 
AnswerRe: do anyone have codes for sql 2005 for saving picture? Pin
yu-jian27-Jun-10 9:18
yu-jian27-Jun-10 9:18 
QuestionHow to make a part of the text as superscript in button text Pin
NarVish23-Jun-10 21:40
NarVish23-Jun-10 21:40 
AnswerRe: How to make a part of the text as superscript in button text Pin
Pete O'Hanlon23-Jun-10 22:07
mvePete O'Hanlon23-Jun-10 22:07 
Questionhow to allign the image at the left corner..... Pin
Nivas8223-Jun-10 20:42
Nivas8223-Jun-10 20:42 
GeneralRe: how to allign the image at the left corner..... Pin
Nivas8223-Jun-10 21:16
Nivas8223-Jun-10 21:16 
QuestionHow to display excel sheet inside a windows form Pin
vineesh v23-Jun-10 20:28
vineesh v23-Jun-10 20:28 
QuestionLatency Meter Pin
satsumatable23-Jun-10 19:20
satsumatable23-Jun-10 19:20 
AnswerRe: Latency Meter Pin
DaveAuld23-Jun-10 20:09
professionalDaveAuld23-Jun-10 20:09 
QuestionInsert dataset into database Pin
shoubi23-Jun-10 16:31
shoubi23-Jun-10 16:31 
AnswerRe: Insert dataset into database Pin
PIEBALDconsult23-Jun-10 17:39
mvePIEBALDconsult23-Jun-10 17:39 
GeneralRe: Insert dataset into database Pin
shoubi23-Jun-10 17:43
shoubi23-Jun-10 17:43 
GeneralRe: Insert dataset into database Pin
PIEBALDconsult23-Jun-10 17:57
mvePIEBALDconsult23-Jun-10 17:57 
GeneralRe: Insert dataset into database Pin
shoubi23-Jun-10 18:07
shoubi23-Jun-10 18:07 
GeneralRe: Insert dataset into database Pin
PIEBALDconsult23-Jun-10 18:17
mvePIEBALDconsult23-Jun-10 18:17 
GeneralRe: Insert dataset into database Pin
shoubi23-Jun-10 19:21
shoubi23-Jun-10 19:21 
Questiongetting the local port as netstat in C# + small doubt on network connection Pin
manustone23-Jun-10 9:37
manustone23-Jun-10 9:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.