sansat6699 Posted December 29, 2007 Share Posted December 29, 2007 hii 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. only this kind of logic i know for getting required values from second table depend on selected items in combobox. any body havind doffrent logic fro this kind of queries involving dataset will be healpfullthank you, Link to comment Share on other sites More sharing options...
sansat6699 Posted December 31, 2007 Author Share Posted December 31, 2007 no body to answer me Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.