Database
  Home arrow Database arrow ADO.NET 101: SqlDataReader
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
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? 
DATABASE

ADO.NET 101: SqlDataReader
By: Jayaram Krishnaswamy
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 11
    2005-03-15

    Table of Contents:
  • ADO.NET 101: SqlDataReader
  • SQLDataReader Class
  • SQLCommand Execution
  • SQLCommand for CommandType: SQL Statement
  • SQLCommand for CommandType: Stored Procedure
  • Stored Procedure with one input and one output parameter
  • SQLCommand's ExecuteXMLReader() Method

  • 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


    ADO.NET 101: SqlDataReader


    (Page 1 of 7 )

    Have you ever wanted to learn more about the functionality of the SQLDataReader? This article, the first in a series, focuses mainly on the SQLDataReader, and also covers the ExecuteReader() and the ExecuteXMLReader() execute methods of SQLCommand.

    This tutorial deals only with the SQLDataReader object. As the SQLDataReader is inherently bound to the SQLCommand object, SQLCommand object is also discussed. SQLCommand object by itself will be discussed in a future tutorial.

    Code for all of the examples is initiated by a button click event, and data display is mostly accomplished by being written to the browser. Sometimes a list box or a text box may be used for parameter entry, or display data; otherwise, there are no other GUIs. The databases are example databases that are commonly found on a SQL Server. The only changes needed for the connection information are the database server name, the database name, and authentication. In the case of SQL authentication, the User ID and Password must be included.

    The Stored Procedures can be created by pasting the code in the Query Analyzer when the proper database is chosen. Since stored procedures are executed, additonal permissions have to be set up for the stored procedures after they are created. This can be carried out easily in the Enterprise Manager.

    SQLConnection

    Before one can get to the SQLCommand, one needs to connect to the SQL Server. This is accomplished by using the SQLConnection. SQLConnection can be made using built-in GU interface or code, and in either case the correct connection string must be specified. This has been dealt with in considerable detail elsewhere(http://www.codeproject.com/aspnet/SQLConnect.asp).

    More Database Articles
    More By Jayaram Krishnaswamy


     

    DATABASE ARTICLES

    - Building Applications with Anonymous Types
    - A Closer Look at Anonymous Types
    - Programming with Anonymous Types
    - Converting Your Excel Worksheet into a Worki...
    - Excel Reference
    - Database Programming in C# with MySQL : Usin...
    - Formatting Techniques for Data Access from E...
    - Data Access from Excel VBA
    - Generating a Multiple Table Crystal Report u...
    - ADO and the Command Object
    - On Wiring Up an ADO Data Control
    - Reading and Writing to Files on the Intranet
    - Using ADO Record to Create and Navigate Intr...
    - Using Data Access Pages to Access Data on a ...
    - Using ADO with the SQL Native Client





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 6 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek