aspx Tutorial

NET Articles,jQuery demo, with jQuery, online tutorial,Jquery, SilverLight, Javascript,,JSON, MVC,.NET Articles,demo, Web Services,
Advertise Here


Get our toolbar!


Posted by Aamir Hasan   on Friday, April 13, 2012 Total Views:  

You can create DataTable class object by using DataTable constructor, DataTable class object create an in-memnory table.

In this example, you will see how to create a DataTable in web application with two columns named “FullName” and “Age” and then I will add new row by using NewRow method. After I will create a new row then I will assign full name and age data to DataRow and I will add new DataRow object to DataTable.


Here’s an example

        DataTable dt = new DataTable();

        DataRow dr = null;


        dt.Columns.Add(new DataColumn("FullName", typeof(string)));

        dt.Columns.Add(new DataColumn("Age", typeof(Int16)));


        dr = dt.NewRow();

        dr["FullName"] = "Aamir Hasan";

        dr["Age"] = 20;




I have debug the code and display it in above screen shot as the datatable has been created successfully, data rows have been added and data has been entered.

Protected by Copyscape Online Plagiarism Tool

Add comment

  Country flag

  • Comment
  • Preview

Advertizement 1
Advertizement 2
Advertizement 3
Advertizement 4
Advertizement 5