public void timer1_Tick(object sender, EventArgs e) { tik--; if (tik == 0) { timer1.Stop(); string constring = @"Data Source=(LocalDB)\v11.0;Initial Catalog=D:\WEBSITE10\APP_DATA\INFO.MDF;Integrated Security=True"; SqlConnection cnn = new SqlConnection(constring); try { string q = "update imagetable set Image_Capture = @pic where email = @Eml"; SqlCommand scmd = new SqlCommand(q, cnn); scmd.Parameters.AddWithValue("@Eml", this.textBox2.Text); if (pictureBox1.Image != null) { MemoryStream ms = new MemoryStream(); pictureBox1.Image.Save(ms, ImageFormat.Jpeg); byte[] photo_array = new byte[ms.Length]; ms.Position = 0; ms.Read(photo_array, 0, photo_array.Length); scmd.Parameters.AddWithValue("@pic", photo_array); } if (cnn.State != ConnectionState.Open) cnn.Open(); SqlDataReader dr = scmd.ExecuteReader(); // cnn.Close(); webcam.Stop(); } catch (SqlException ex) { MessageBox.Show(ex.Message); } } }
using
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)