The Power of the DataSet's DataTable and DataRow Objects
page 1 of 2
Published: 01 Nov 2004
Unedited - Community Contributed
I was recently tasked to write an ASP.NET application that would have taken a lot longer to code using Classical ASP. Thanks to ASP.NET things came together flawlessly. This article will go into more details about how the DataSet, DataTable, and DataRow contributed to my success.
by King & Keith Wells
Average Rating: 
Views (Total / Last 10 Days): 15039/ 39


Recently, I was tasked to write an ASP.NET application that allowed a user to make corrections to his data, validate the change on a specific row and save the change back to the Oracle database. Also, if a user clicked the refresh hyperlink, he could reset the values for that specific row back to the original values. The application would also allow the user to search for a specific domain value via a popup window and save the value back to the designated field of the specified row. This application had to dynamically identify the table that needed correcting. This table was identified by getting the scheme and table name from a configuration table. Now, for this version, release 1, the columns were static and easily identified.

For release 2 of this same application, the column names were generated dynamically and were no longer static. Since each department in the company had different naming conventions for its table definition, we could not assume that we knew what the column names would be.  So now, we had to identify the table and the columns dynamically. I also used the DataGrid in this project so that the customer could navigate throughout the entire recordset via the DataGrid’s paging capability and make changes to any row within the Table object. Furthermore, the controls inside of the DataGrid would dynamically show only those columns that were used by a specific system. For example if your key values consisted of three columns then only those three columns would be rendered to the screen, and if the key column consisted of only one column then only that one column would be shown. This was a very dynamic DataGrid that changed when the configuration table changed.

The solution was to use a DataSet to save and manipulate the data. I was not a fan of the DataSet and I felt that it was often overkill. I mean really guys, how many developers would find a need to manipulate more than one table within a DataSet? But, after working on this project, I am more of a fan now. Well, I am really a fan of the DataTable and the DataRow not the DataSet. But, since I cannot populate a DataTable without the DataSet, I am now a DataSet fan.

What was most exciting about the DataTable was how easy it was to identify a row that needed updating. To identify the row, the DataRowCollection provides a method called Find(). This method acquires a specific row identified by the array of primary key values passed to it.

View Entire Article

User Comments

Title: save the value from dynamic table   
Name: sanjay
Date: 2007-03-03 12:46:32 AM
i am create dynamic table in page and i entered value in run time and save those value from table when i click to save button then page postback and all value refresh...then how i save those value in database...
Name: alex
Date: 2006-04-07 4:55:28 AM
I may just start being a fan of dataset if mi am helped thnanks
Title: Identify the Dynamic Table Objects   
Name: Prabakar
Date: 2005-06-26 10:49:00 PM

I'm using a Dynamic Table to edit a database table

Which shows all the records in it...

and I can retrive the data from database but I don't know

how to find the datas entered in the Dynamic Objects...

I have three Text box in my Dynamic Table I want know their ID or name Property in the code behind
Title: Web Developer   
Name: Peer Sajad
Date: 2005-03-15 11:13:12 PM
I was just wandering how to do it, thankyou very much!
Name: Bill Phillips
Date: 2005-01-30 11:46:16 AM
I'm learning more and more about .Net. Your insight helps to further understand how useful the Dataset and Datatable are in developing software.
I see already the time I save by not having to create all my reports(web) using .asp pages.
I've been in this business a long time and glad to see you guys are doing ok.

Thank you for your input


Community Advice: ASP | SQL | XML | Regular Expressions | Windows

©Copyright 1998-2024  |  Page Processed at 2024-05-23 5:07:57 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search