private void button1_Click(object sender, EventArgs e)
{
for (int x = 0; x < ds.Tables[0].Rows.Count; x++)
{
if (comboBox1.SelectedItem.ToString() == ds.Tables[0].Rows[x].ItemArray[0].ToString() &&
comboBox2.SelectedItem.ToString() == ds.Tables[0].Rows[x].ItemArray[1].ToString())
{
if (comboBox3.SelectedItem.ToString() == ds.Tables[0].Rows[x].ItemArray[2].ToString())
{
MessageBox.Show("This Items is Already there");
// comboBox3.SelectedItem = null;
clear1();
return;
}
}
cm = new SqlCommand("insert into covers(MobileBrand,MobileModel,Type) values('" + comboBox1.Text.ToString() + "','" + comboBox2.Text.ToString() + "','" + comboBox3.SelectedItem.ToString() + "')", cn);
cm.ExecuteNonQuery();
MessageBox.Show("Data Inserted");
clear1();
fetch();
return;
}
}