SqlConnection cnn = new SqlConnection(@"Data Source=DANNY-PC\SQLEXPRESS;Initial Catalog=coba;Integrated Security=True;Pooling=False"); byte[] imgData = File.ReadAllBytes(pictureBox1.ImageLocation); MessageBox.Show(Convert.ToString(imgData)); // How to display image data in message box? int varID = Convert.ToInt16(textBox1.Text); string varNama = textBox2.Text; SqlCommand cmd = new SqlCommand("INSERT INTO Table2 (ID,Nama,Foto) VALUES (@ID,@Nama,@Foto)", cnn); cmd.Parameters.Add("@ID", varID); cmd.Parameters.Add("@Nama", varNama); cmd.Parameters.Add("@Foto", imgData); cnn.Open(); cmd.ExecuteNonQuery(); cnn.Close();
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)