private void button6_Click(object sender, EventArgs e) { frmRemoveStock removeStock = new frmRemoveStock(); this.Hide(); removeStock.Show(); }
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { SqlConnection con = new SqlConnection(conSt); con.Open(); selected = dataGridView1.CurrentCell.RowIndex; DataGridViewRow row = dataGridView1.Rows[selected]; string a = Convert.ToString(row.Cells[1].Value); if (e.ColumnIndex == 0) { if (con.State == System.Data.ConnectionState.Open) { //string data = String.Format("DELETE AddStock SET ItemName = '{0}', ItemQuantity = {1} , PricePerPiece = {2} , ItemType = '{3}' , Milligram = {4} , ManufacturedBy = '{5}' , MLNumber = '{6}' , ExpirationDate = '{7}' WHERE ItemName = '{8}'", textBox1.Text, int.Parse(textBox5.Text), int.Parse(textBox2.Text), comboBox1.Text, int.Parse(textBox4.Text), comboBox3.Text, textBox3.Text, DateTime.Parse(dateTimePicker1.Text.ToString()), temp_name); //SqlCommand cmd = new SqlCommand(data, con); string data = String.Format("DELETE FROM AddStock WHERE ItemName = '{0}'", a); SqlCommand cmd = new SqlCommand(data, con); cmd.ExecuteNonQuery(); } } frmRemoveStock removeStock = new frmRemoveStock(); this.Hide(); removeStock.Show(); }