Example #1
0
        private void button3_Click(object sender, EventArgs e)
        {
            Form10 f2 = new Form10();

            this.Hide();
            f2.label6.Text = textBox1.Text.ToString();
            f2.label7.Text = textBox2.Text.ToString();
            f2.label8.Text = textBox3.Text.ToString();

            f2.pictureBox1.Image = Image.FromFile(f1.FileName);
            MemoryStream ms1 = new MemoryStream();

            f2.pictureBox1.Image.Save(ms1, System.Drawing.Imaging.ImageFormat.Jpeg);
            f2.pictureBox2.Image = Image.FromFile(f1.FileName);
            MemoryStream ms2 = new MemoryStream();

            f2.pictureBox2.Image.Save(ms2, System.Drawing.Imaging.ImageFormat.Jpeg);
            byte[] img_arr1 = new byte[ms1.Length];
            byte[] img_arr2 = new byte[ms2.Length];
            ms1.Read(img_arr1, 0, img_arr1.Length);
            ms2.Read(img_arr1, 0, img_arr2.Length);

            f2.Show();
            connection.Open();
            string query;

            query = "insert into student_record(name,qualifiaction,age,image,signature) values(@a,@b,@c,@d,@e)";
            SqlCommand sqlcommand = new SqlCommand(query, connection);

            //'" + textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "','" +f2.pictureBox1.Image+ "','"+f2.pictureBox2.Image+"'
            sqlcommand.Parameters.AddWithValue("@a", textBox1.Text);
            sqlcommand.Parameters.AddWithValue("@b", textBox2.Text);
            sqlcommand.Parameters.AddWithValue("@c", textBox3.Text);
            sqlcommand.Parameters.AddWithValue("@d", img_arr1);
            sqlcommand.Parameters.AddWithValue("@e", img_arr2);



            sqlcommand.ExecuteNonQuery();
            connection.Close();
        }
Example #2
0
        private void button7_Click(object sender, EventArgs e)
        {
            Form10 m = new Form10();

            m.Show();
        }
Example #3
0
        private void Button1_Click(object sender, EventArgs e)
        {
            Form f10 = new Form10();

            f10.ShowDialog();
        }