ASP
  Home arrow ASP arrow Page 7 - ASP Database Fundamentals (Part 2)
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  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Moblin 
JMSL Numerical Library 
Windows Web Hosting
 
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? 
ASP

ASP Database Fundamentals (Part 2)
By: Rich Smith
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 42
    2003-08-27

    Table of Contents:
  • ASP Database Fundamentals (Part 2)
  • How Do They Work?
  • Lets Get Technical
  • Getting Data From Your Database
  • How About SQL?
  • Do I Have Data Now?
  • How do I Get At The Data?
  • What If There Is More Than One Row?
  • What’s Next?

  • 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


    ASP Database Fundamentals (Part 2) - How do I Get At The Data?


    (Page 7 of 9 )

    We are getting closer to the end of the trail. We can now open recordsets and know if we have data in them. But how do we get at it?

    The data in the fields is available by asking for it by name. For example, here is a piece of code to read the first and last names from the recordset:

     set rs Server.CreateObject("ADODB.recordset"rs.open “select from Customers”conn response.write “The customer’s name is “ rs(“FirstName”) & _ “ “ rs(“LastName”rs.close set rs nothing 

    You can also access the data by utilizing the “fields” collection of the recordset object. This collection contains all of the columns that are in the recordset. Consider this example:

     set rs Server.CreateObject("ADODB.recordset"rs.open “select from Customers”conn for each x in rs.Fields Response.Write(x.nameResponse.Write(" = "Response.Write(x.value "
    "
    next rs.close set rs nothing 

    This example would go through all of the columns in the recordset and display the fieldname and the value.

    More ASP Articles
    More By Rich Smith


     

    ASP ARTICLES

    - ADO for the Beginner
    - ADO.NET 101: Data Rendering with a DataGrid ...
    - Introducing SoftArtisans OfficeWriter 3.0 En...
    - Getting Remote Files With ASP
    - The Real Basics of Functions in ASP
    - Enhancing Readability with ASP
    - Mimicking PHP's String Formatting Functions
    - Windows Server Hacks 12, 77, and 98
    - How to Sort a Multi-Dimensional Array
    - Developing an Information Management Tool wi...
    - What are Active Server Pages?
    - Getting Remote Pages with ASP
    - FTP’ing Files with ASP
    - Apply Single-Sign-On to Your Application
    - Easy Error Management





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
    Stay green...Green IT