hi
i have code like given below. i am using asp.net2.0(c#), sqlserver 2000
public void loadmunitcombo(ComboBox cmbunit,string sFilter)
{
DataSet ds1 = new DataSet();
DataTable munit1 = new DataTable("munit1");
string conStr = ConfigurationSettings.AppSettings["asccon"];
System.Data.SqlClient.SqlConnection dbCon = new System.Data.SqlClient.SqlConnection(conStr);
System.Data.SqlClient.SqlConnection dbCon1 = new System.Data.SqlClient.SqlConnection(conStr);
dbCon.Open();
SqlDataReader dr;
SqlCommand cmd = new SqlCommand("select * from MUTran where M_ID='" + sFilter + "'",dbCon);
dr = cmd.ExecuteReader();
while (dr.Read())
{
string str1;
dbCon1.Open();
SqlDataReader dr1;
SqlCommand cmd1 = new SqlCommand("select * from UM where U_Id="+dr.GetInt32(2)+"",dbCon1);
dr1 = cmd1.ExecuteReader();
while (dr1.Read())
{
//here i want to insert data in to datatable one by one and after completion of while loop i want to insert table into dataset
ListItem li = new ListItem();
li.Text = dr1.GetString(1);
li.Value = dr1.GetInt32(0).ToString();
cmbunit.Items.Add(new ComboBoxItem(li.Text.ToString()));
}
dr1.Close();
dbCon1.Close();
//here i want to create dataset fro created table above
}
dr.Close();
dbCon1.Close();
} so please help me in creating datatable and then insert datatable into dataset.
thank you,