private void button5_Click(object sender, EventArgs e) { OracleConnection conn = null; try { MemoryStream ms = new MemoryStream(); this.pictureBox2.Image.Save(ms, ImageFormat.Bmp); string asd = "Data Source=localhost;User ID=system;Password=oracle"; conn = new OracleConnection(asd); conn.Open(); string sql = " update CITYSMART.CREATEBARCODE set item_barcode='" + textBox1.Text + "',item_name='" + item_name.Text + "' where barcode_id=" + barcodeid.Text + ""; OracleCommand cmd = new OracleCommand(); // OracleParameter param = new OracleParameter("@barcode_image", OracleDbType.Blob, ms.GetBuffer().Length); // OracleParameter param = new OracleParameter("@BarcodeImage",Oracle.DataAccess.Client.OracleDbType.Blob,pictureBox1.Image); // param.Value = ms.GetBuffer(); //cmd.Parameters.Add(param); cmd.Connection = conn; cmd.CommandText = sql; cmd.ExecuteNonQuery(); generatebarcodeclass gentitem = new generatebarcodeclass() { itemId = Convert.ToInt32(barcodeid.Text.Trim()), itemBarcode = textBox1.Text.Trim(), itemName = item_name.Text.Trim(), // imagePicture=Convert.ToByte []() }; listadd.Add(gentitem); dataGridView1.DataSource = null; dataGridView1.DataSource = listadd; MessageBox.Show("UpDate Successfully"); conn.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Information); } button4.Enabled = true; }
// validdated check public void validcheck() { if (IsValidated()) { generatebarcodeclass gentitem = new generatebarcodeclass() { itemId = Convert.ToInt32(barcodeid.Text.Trim()), itemBarcode = textBox1.Text.Trim(), itemName = item_name.Text.Trim(), // imagePicture=Convert.ToByte []() }; listadd.Add(gentitem); dataGridView1.DataSource = null; dataGridView1.DataSource = listadd; } }
private void button6_Click(object sender, EventArgs e) { OracleConnection conn = null; try { string asd = "Data Source=localhost;User ID=system;Password=oracle"; conn = new OracleConnection(asd); conn.Open(); string sql = " delete from CITYSMART.CREATEBARCODE where barcode_id= " + barcodeid.Text + " "; OracleCommand cmd = new OracleCommand(sql, conn); cmd.ExecuteNonQuery(); generatebarcodeclass gentitem = new generatebarcodeclass() { itemId = Convert.ToInt32(barcodeid.Text.Trim()), itemBarcode = textBox1.Text.Trim(), itemName = item_name.Text.Trim(), // imagePicture=Convert.ToByte []() }; listadd.Add(gentitem); dataGridView1.DataSource = null; dataGridView1.DataSource = listadd; MessageBox.Show("Delete Data Successfully"); conn.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Information); } button4.Enabled = true; }