Это мой код. Значение комбинированного списка отображается в базе данных, а сетка данных равна 0, 1.
private void buttonsave_Click(object sender, EventArgs e)
{
//SqlConnection connection = new SqlConnection("Data source='LAPTOP-RSHUE2L7\\SQLEXPRESS';initial catalog ='Data Entry'; integrated security ='SSPI';");
connection.Open();
SqlCommand command = new SqlCommand();
command.Connection = connection;
command.CommandText = "insert into entry values(@serialno, @name, @fathername, @gender, @cnic, @mobile, @birthdate, @address, @vc, @tehsil, @district,@occupation)";
command.Parameters.Add(new SqlParameter("@serialno", textBoxserial.Text));
command.Parameters.Add(new SqlParameter("@name", textBoxname.Text));
command.Parameters.Add(new SqlParameter("@fathername", textBoxfathername.Text));
command.Parameters.Add(new SqlParameter("@gender", comboBoxgender.SelectedIndex.ToString()));
command.Parameters.Add(new SqlParameter("@cnic", textBoxcnic.Text));
command.Parameters.Add(new SqlParameter("@mobile", textBoxmobile.Text));
command.Parameters.Add(new SqlParameter("@birthdate", dobdateTimePicker1.Value.ToString()));
command.Parameters.Add(new SqlParameter("@address", textBoxaddress.Text));
command.Parameters.Add(new SqlParameter("@vc", textBoxvc.Text));
command.Parameters.Add(new SqlParameter("@tehsil", textBoxtehsil.Text));
command.Parameters.Add(new SqlParameter("@district", textBoxdistrict.Text));
command.Parameters.Add(new SqlParameter("@occupation", textBoxoccupation.Text));
command.ExecuteNonQuery();
connection.Close();
MessageBox.Show("Data added");
}