locked
Convert DataTable to DataSet in c# With Examples RRS feed

  • General discussion

  • hi..

     Sample Code for Converting The DataTable Data to Dataset in Asp.net using c#

    Code:-

            DataTable Dt = new DataTable();
            Dt.Columns.Add("Name", typeof(string));
            Dt.Columns.Add("Age", typeof(int));
            Dt.Columns.Add("Mailid", typeof(string));
            Dt.Rows.Add("Mohamed",26,"mohamed@xyz.com");
            Dt.Rows.Add("Raja", 27,"Raja@xyz.com");
            Dt.Rows.Add("uthaya", 28,"Uthaya@xyz.com");
            DataSet ds = new DataSet("table");
            ds.Tables.Add(Dt); 

    Hope this Help....................

    Monday, February 11, 2013 12:10 PM

All replies

  • Hello,

    Thanks for sharing but this forum is for developer questions. If you would like to share your code please visit Sample code site.


    kevininstructor

    Monday, February 11, 2013 3:20 PM