i need one help in my code. i am using a window based application . in my code
i have one combobox(courtnamelist) which is a category. ane sub categories where i have kept five more comboboxs(heighcourtlist,labourcourtlist,distictcourt..ect)
i want, when i select courtnamelist item's so its corresponding combobox list should be visible and when i choose corresponding list item and click the add button so item should be insert into the database columns..
i have created a void method and i have wrote all codes into it .
i have tried but i am not able to get the results . please check my codes and show me the right path of my codes
public void data2()
{
int index1 = courtnamelist.SelectedIndex;
if (0 == index1)
{
supremecourtlist.Visible = true;
con = new SqlConnection("Data Source=.;Initial Catalog=DSIIDC2;Integrated Security=True");
con.Open();
string str = "insert into addcaasedetails(caseno,casetype,courtname,feetocounsil,record,nextdateofhearing,status,supremecourtbranch) values(@caseno,@casetype,@courtname,@nameofcourt,@feetocounsil,@record,@nextdateofhearing,@status,@supremecourtbranch)";
cmd = new SqlCommand(str, con);
cmd.Parameters.AddWithValue("@caseno", Convert.ToInt32(txtcaseno.Text));
cmd.Parameters.AddWithValue("@casetype", casetypelist.SelectedItem);
cmd.Parameters.AddWithValue("@courtname", courtnamelist.SelectedItem);
cmd.Parameters.AddWithValue("@nameofcounsil", txtnameofthecounsel.Text);
cmd.Parameters.AddWithValue("@feetocounsil", Convert.ToDecimal(feespaybletothecounsel.Text));
cmd.Parameters.AddWithValue("@nextdateofhearing", nextstatusofcounseldateTimePicker1.Value);
cmd.Parameters.AddWithValue("@status", txtstatus.Text);
cmd.Parameters.AddWithValue("@record", txtrecords.Text);
cmd.Parameters.AddWithValue("@supremecourtbranch", supremecourtlist.SelectedItem);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
}
else if(1==index1)
{
heighcourtlist.Visible = true;
}
else if (2 == index1)
{
districtcourtlist.Visible = true;
}
else if (3 == index1)
{
nationlgreentribunallict.Visible = true;
}
}