Web Developer's Virtual Library: Encyclopedia of Web Design Tutorials, Articles and Discussions


WDVL Newsletter

Active Server Pages
JSP/Java Servlets
Microsoft SQL Server
Daily Backup
Dedicated Servers
Streaming Audio/Video
24-hour Support    

jobs.webdeveloper.com

Hiermenus


e-commerce
Partner With Us















Developer Channel
FlashKit.com
JavaScript.com
JavaScriptSource
Developer Jobs
ScriptSearch
StreamingMediaWorld
Web Developer's Journal
Web Developer's Virtual Library
WebDeveloper.com
Webreference
Web Hosts
XMLfiles.com

internet.com
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers


Simple Recordsets - Reading Data - Page 2

November 27, 2000

So you've decided that ASP-ADO is the solution for your situation, and you've learned how to set it up. Now you're ready to begin using ASP-ADO to access and manipulate data within web pages. This chapter discusses the simplest situation – the simple task of reading the data. Although we are only reading the data, we can still use it in several ways. Not only can we write it to the page; we can also use the data in variables, expressions and as the arguments for other functions.

Then we look at some of the techniques and problems with presenting the data that we read in an HMTL table. Last, even though VBScript implements only parts of Object Oriented Programming, we'll include a few paragraphs to provide an overview of the aspects of OOP that are available.

Preparing to use Simple Recordsets

One of my sailing coaches emphasized that yacht races are won or lost long before the day of the race. Regattas are won during the months of preparation and training prior to the starting gun. Fortunately, ADO does not require many weeks of practicing tacks and jibes in the cold rain; you just have to consider the following three issues:
  • Creating a DSN
  • Having the correct User Identification, Password and Permissions
  • Understanding the structure of the database

Step 1 - Create a DSN

In Chapter 2 we talked about creating an ODBC Data Source which is referred to by a DSN – this is typically performed by a systems administrator or other operator with access to the server. To review: the DSN contains the information necessary to make a physical connection into the database. This information may include database name, path, server name, User ID, Password, Driver name and other parameters.. These pieces of information are wrapped up in a DSN, which is given a name. You need to get the name of your DSN from your systems administrator prior to using ASP-ADO.

If you are working on PWS you have access to the settings of your Windows OS and can set your own DSN (also discussed in Chapter 2), by selecting Start | Control Panel | 32 bit ODBC and following the steps of the wizard. In my development work I keep two copies of the database – one on my development machine using PWS and one on the server.

In Chapter 6, we will talk about how to make a connection without a DSN.

Step 2 - User Identification and Password

I'm frequently approached by people seeking help with ADO, only to find that the problem is not with their ADO code, but that they do not have access rights to the database they're trying to use. Even if you're only going to request a simple recordset, you need to meet the security requirements of the database. Generally this means that you present a User Identification (UserID) and a password (pwd). Security can be established at various levels, but you will need to get this information from the owner or systems administrator of the database.

Step 3 - Understand the Structure of the Database

Another obvious (but frequently overlooked) point of preparation is understanding the structure of the database. ADO will always produce errors if your commands don't use the exact spelling of the tables, queries, views and fields. A more subtly but equally deadly error arises when commands to the database conflict with its relationships between tables. In Chapter 5 we'll look at a technique for finding out the names of the fields, but you still have to know the names of the tables. The structures of the tables used in this book are provided in Appendix A.

Common Errors in preparation:

  • Incorrect spelling of DSN
  • DSN no longer exits, or name has been changed
  • The DSN will not work if the file is moved to another location after the DSN is created (applies to Access and Excel files).
  • DSN is of User or File type rather than a System DSN
  • UserID or password is misspelled or incorrect
  • Names of fields or tables are incorrectly known by plural or singular (e.g. Author instead of Authors)
  • Type (number/text/date) of fields is not known correctly

Beginning ASP Databases
Beginning ASP Databases
Syntax for Simple Recordsets - Page 3


Up to => Home / Authoring / ASP / BeginningASPDatabases




Jupiter Online Media: internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and Jupiter Online Media

Jupitermedia Corporate Info


Legal Notices, Licensing, & Permissions, Privacy Policy.

Web Hosting | Newsletters | Tech Jobs | Shopping | E-mail Offers