PictureBox image save to database and easy to show on crystal report or microsoft report
byte[] photo = File.ReadAllBytes(txtImage.Text);
Query = "INSERT INTO RegistrationForm(ImagePath, Photo)VALUES('" + txtImage.Text.Trim() + "',@photo)";
SqlCommand cmd = new SqlCommand(Query, dut.cnn);
cmd.Parameters.AddWithValue("@photo", photo);
cmd.ExecuteNonQuery();
MessageBox.Show("Student Registration Successfully ", " Information ", MessageBoxButtons.OK, MessageBoxIcon.Information);
sql server database table-- taken Photo field TYpe- VarBinary(max)
txtImage is the path value of picture box ; this value convert in to byte , then insert into sql server databse table field name photo
No comments:
Post a Comment