Jyoti Jodha

Jyoti Jodha

  • NA
  • 1.7k
  • 406.4k

how to selected combo box item name C#

Apr 27 2017 7:49 AM
how to selected combobox item name show in gridview and ID save in database
and same work on Update Queery in windows application c#
 
 
 // Insert Queery
cmd = new SqlCommand("insert into Product(Name,Description,Tax_ID,Unit_ID) values(@Name,@Description,@Tax_ID,@Unit_ID)", con);
con.Open();
cmd.Parameters.AddWithValue("@Name", txtName.Text);
cmd.Parameters.AddWithValue("@Description", txtdec.Text);
cmd.Parameters.AddWithValue("@Tax_ID", comboBoxtax.Text);
cmd.Parameters.AddWithValue("@Unit_ID", comboBoxunit.Text);
 
 
 // Update Queery
cmd = new SqlCommand("update Product set Name=@Name,Description=@Description,Tax_ID=@Tax_ID,Unit_ID=@Unit_ID where Product_ID=@id", con);
con.Open();
cmd.Parameters.AddWithValue("@id", Product_ID);
cmd.Parameters.AddWithValue("@Name", txtName.Text);
cmd.Parameters.AddWithValue("@Description", txtdec.Text);
cmd.Parameters.AddWithValue("@Tax_ID", comboBoxtax.Text);
cmd.Parameters.AddWithValue("@Unit_ID", comboBoxunit.Text);
 

Answers (4)