ADO.NET DataTable

We always need to create temporary tables using DataTable class in ADO.NET. The following is the way to create a table considering the table schema to be custid,custname,dob.

DataTable custDT = new DataTable(“Customer”);
custDT.Columns.Add(“CustomerId”,typeof(int));
custDT.Columns.Add(“CustomnerName”,typeof(string));
custDT.Columns.Add(“DateOfBirth”,typeof(DateTime));

 The above created a DataTable with 3 columns.

Advertisements

6 Responses

  1. how can v retrive the data from temporarly created table…..?

  2. I f I understood correctly the following is your problem…you have created a table temporarily and inserted rows. Now you would like to retrieve rows based on filter. If that is your question then use

    Datatable Select method to retrieve rows based on filter once rows are added to the datatable.

    I hope this helps you.

  3. respectinc.com

    Useful, thank you!

  4. Comprehensive – HDMI Cables | DVI Cables | VGA Cables| Audio Video Cables | Computer Cables

    Useful, thank you!

  5. Hotels and Travel Services in Turkey

    Useful, thank you!

  6. Stock Yards Bank & Trust Company

    Useful, thank you!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: