HI all, I just want to ask how we can add more than 1 table in dataset or dataadapter through coding not through wizard.

Hi Gaurav,

chekc the next code to add datatables to dataset

//declare dataset and datatables
            DataSet ds = new DataSet("DS");
            DataTable dt1 = new DataTable("DT1");
            DataTable dt2 = new DataTable("DT2");

            // add columns by code
            dt1.Columns.Add("Col1", typeof(Int32));
            dt1.Columns.Add("Col2", typeof(string));
            dt1.Columns.Add("Col3", typeof(string));

            dt2.Columns.Add("Cl1", typeof(Int32));
            dt2.Columns.Add("Cl2", typeof(string));

            // add datatables to dataset 
            ds.Tables.Add(dt1);
            ds.Tables.Add(dt2);


            // to access tables by name or by no.
            // this to access table by name to get dt1
            DataTable dtTemp =  ds.Tables["DT1"];

            //this will return DT1
            DataTable dtTemp2 = ds.Tables[0];