SunQuest
 
       ADO.NET
  Home arrow ADO.NET arrow Page 2 - Datasets in Microsoft.Net
IBM developerWorks
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Dedicated Servers  
Actuate Whitepapers 
Moblin 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
ADO.NET

Datasets in Microsoft.Net
By: Raghav Nayak
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 127
    2004-03-24

    Table of Contents:
  • Datasets in Microsoft.Net
  • RecordSet Objects
  • Validating data in DataSet
  • Validation Properties of the DataColumn
  • The DataTable Object’s Constraints Collection
  • Creating Dataset at Design Time
  • Adding DataColumn Objects
  • New DataSet

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

    Datasets in Microsoft.Net - RecordSet Objects


    (Page 2 of 8 )

    For example, if you use just the default settings for the ADO Recordset and Connection objects, you cannot get an accurate count of the number of rows in the Recordset. The Recordset object has a Supports method that developers often use to determine the functionality available: Can I modify the contents of the Recordset? If I update a row, will the Recordset send the change to the database immediately or will it be cached? Can I bind my Recordset to a grid? Can I move to the previous row?

    The reason that not all Recordset objects support the same functionality is that the Recordset object tries to be everything to everyone. Whether you’re working with a firehose cursor, a server-side cursor, or disconnected data in ADO, you’re using a Recordset object.

    Creating a DataSet

    Using VB.Net


     Dim ds As New 
    DataSet("DataSetName")
     Console
    .WriteLine(ds.DataSetName)

    Using C#.Net


    DataSet ds = new 
    DataSet("DataSetName");
    Console
    .WriteLine(ds.DataSetName);

    Filling the DataSet Object

    Filling the data from database into dataset object is a very easy process. Here we can use either SQL query or a stored procedure. Below is the example of how to fill data using query.

    Using VB.Net


    Dim strConnstrSQL As 
    String
    strConn 
    "Provider=SQLOLEDB;Data Source=(local)NetSDK;" 
    _
              
    "Initial 
    Catalog=Northwind;Trusted_Connection=Yes;"

    strSQL 
    "SELECT CustomerID, 
    CompanyName, ContactName, Phone " 

    _
             
    "FROM Customers"
    Dim da 
    As New OleDbDataAdapter(strSQLstrConn)
    Dim ds 
    As New 
    DataSet()
    da
    .Fill(ds"Customers")

    Using C#.Net


    string strConn
    strSQL;
    strConn 
    "Provider=SQLOLEDB;Data Source=(local)\NetSDK;" 
    +
              
    "Initial 
    Catalog=Northwind;Trusted_Connection=Yes;"
    ;
    strSQL 
    "SELECT CustomerID, 
    CompanyName, ContactName, Phone " 
    +
             
    "FROM 
    Customers"
    ;
    OleDbDataAdapter da 
    = new OleDbDataAdapter(strSQL
    strConn);
    DataSet ds 
    = new DataSet();
    da
    .Fill(ds
    "Customers");

    More ADO.NET Articles
    More By Raghav Nayak


     

    ADO.NET ARTICLES

    - Datasets in Microsoft.Net
    - Latest Developments in the .Net World
    - Introduction to .NET
    - Automatic Generation of Single Table SQL Sta...
    - Data Access in .NET using C#: Part 1
    - All You Need To Know About ADO.NET: Part 2/2
    - All You Need To Know About ADO.NET: Part 1/2
    - Easing Transition From ASP and ADO to ASP.NE...
    - A Practical Comparison of ADO and ADO.NET







    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway