ASP.NET Basics (Part 9): Different Strokes - Endgame
(Page 5 of 5 )
Endgame
And that's about all I have for you today. Continuing where I left off in the first part of this tutorial on database interaction using ASP.NET, I started with a simple example that demonstrated the capabilities of the SqlDataAdapter and DataSet object. Here, I highlighted the differences between the DataReader and SqlDataAdapter objects, and explained why you will find the latter more useful than the former.
This was followed by another example that explained how you can use the same set of objects (SqlDataAdapter and DataSet) along with the DataTable and DataRow objects to add a new record to a database. Since there's more than one way to skin a cat, the last example demonstrated yet another technique to update database records, using a combination of the SqlDataAdapter, DataSet and SqlCommand objects to fetch and alter the selected records.
If this introductory tutorial has whetted your appetite, you can read more about the ADO.NET classes I've used in the last two articles on MSDN, at the following links:
The SqlDataReader class, at
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/ frlrfSystemDataSqlClientSqlDataReaderClassTopic.asp
The SqlDataAdapter class, at
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/ frlrfSystemDataSqlClientSqlDataAdapterClassTopic.asp
The SqlDataCommand class, at
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/ frlrfSystemDataSqlClientSqlCommandClassTopic.asp
The DataSet class, at
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/ frlrfSystemDataDataSetClassTopic.asp
The DataTable class, at
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/ frlrfSystemDataDataTableClassTopic.asp
The DataRow class, at
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/ frlrfSystemDataDataRowClassTopic.asp
Next time, I'll be showing you how to add exception handling to your ASP.NET scripts, with examples of how to catch errors and exit gracefully when things go wrong. Until then, play with the various objects I introduced today - they should keep you busy for a while!
Note: Examples are illustrative only, and are not meant for a production environment. Melonfire provides no warranties or support for the source code described in this article.
| DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |