Click here to Skip to main content
15,912,400 members
Home / Discussions / C#
   

C#

 
GeneralRe: how to:C# Datagridview must show only fixed number of rows Pin
Mycroft Holmes24-Jun-10 1:14
professionalMycroft Holmes24-Jun-10 1:14 
QuestionDetect scroll to end of document in a webbrowser control Pin
Chris Quinn23-Jun-10 22:39
Chris Quinn23-Jun-10 22:39 
AnswerRe: Detect scroll to end of document in a webbrowser control Pin
Pete O'Hanlon24-Jun-10 1:04
mvePete O'Hanlon24-Jun-10 1:04 
GeneralRe: Detect scroll to end of document in a webbrowser control Pin
Chris Quinn28-Jun-10 1:14
Chris Quinn28-Jun-10 1:14 
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 
You would save it with something like this:
private void SaveImageToDb(string fileName, SqlConnection sqlConnection)
{
  // save image to a memory stream
  using (MemoryStream ms = new MemoryStream())
  {
    Image.FromFile( fileName ).Save( ms, System.Drawing.Imaging.ImageFormat.Bmp );

    using (SqlCommand sqlCmd = new SqlCommand( 
      "INSERT INTO MyTable(MyImage) VALUES (@Image)", sqlConnection ))
    {
      sqlCmd.Parameters.Add( "@Image", SqlDbType.Image );

      // The image is set based on the byte array in the MemoryStream.
      sqlCmd.Parameters [ "@Image" ].Value = ms.GetBuffer( );

      // execute command
      sqlCmd.ExecuteNonQuery( );
    }
  }
}
I've just knocked this up in the web editor, so I apologise if the syntax isn't 100% perfect.

"WPF has many lovers. It's a veritable porn star!" - Josh Smith

As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.


My blog | My articles | MoXAML PowerToys | Onyx



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 
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 

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.