Hello every1,I have a form in visual c# which contain 12 textboxes,2 comboboxes,1 richtextbox,&3 checkboxes,some one plz help me
1. how to retrieve data for combobox from database?
2. how to show the checkbox values in database?
For inserting the values in textbox to database, here is my code:-
private void btnsave_Click(object sender, EventArgs e)
{
SqlConnection sc = new SqlConnection("Data Source=Marvella-1240\\SQLEXPRESS;Initial Catalog=Customer;Integrated Security=True");
SqlCommand cmd;
{
try
{
sc.Open();
cmd = new SqlCommand("insert into [dbo].[CustomerValidationtext] values('" + textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "','" + textBox4.Text + "','" + textBox5.Text + "','" + textBox6.Text + "','" + textBox7.Text + "','" + textBox8.Text + "','" + textBox9.Text + "','" + textBox10.Text + "','" + textBox11.Text + "','" + textBox12.Text + "')", sc);
cmd.ExecuteNonQuery();
MessageBox.Show("save to Db");
sc.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}