Byte [] filebyteaRray; system.io.MemoryStream imagesTream;
this.sqlConnection1.ConnectionString = strConn; try {if (this.sqlConnection1.State == ConnectionState.Closed) this.sqlConnection1.Open (); this.sqlCommand1.CommandText = "insert into MyImage (MyImage) values (@MyImage)" Imagestream = new memorystream (); image1.save (Imagestream, System.drawing.Imaging.ImageFormat.jpeg);
FileByteArray = new byte [control.Toint32 (Imagestream.length)];
Imagestream.read (FileByteaRray, 0, Convert.Toint32 (Imagestream.length);
. SqlCommand1.Parameters.Add (new SqlParameter ( "@ MyImage", SqlDbType.Image, Convert.ToInt32 (ImageStream.Length))) Value = FileByteArray; sqlCommand1.ExecuteNonQuery (); MessageBox.Show ( "Add success!"); } Catch (exception ex) {messagebox.show (ex.Message);