private void toolStripButton1_Click(object sender, EventArgs e) { // open file dialog OpenFileDialog open = new OpenFileDialog(); // image filters open.Filter = "Image Files(*.jpg; *.jpeg; *.gif; *.bmp)|*.jpg; *.jpeg; *.gif; *.bmp"; open.FilterIndex = 2; if (open.ShowDialog() == DialogResult.OK) { using (SqlCeCommand cmd = new SqlCeCommand("INSERT into imag(image)VALUES(@image)", con)) { Stream fileStream = open.OpenFile(); fileStream.CopyTo(ms); byte[] a = ms.GetBuffer(); cmd.Parameters.Clear(); cmd.Parameters.AddWithValue("@image", a); cmd.ExecuteNonQuery(); this.imagTableAdapter.Fill(this.bb1DataSet.imag); this.imagBindingSource.MoveLast(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)