January 25, 2021
Hot Topics:

Using ASP with VB Components

  • By Sam Huggill
  • Send Email »
  • More Articles »

ADO (ActiveX Data Objects) is relatively new to the database world, and I have to say, not many people like it. But aside from that, a lot of people use it, mainly because it is flexible around using different datasources. Thus, Microsoft included ADO with the ASP server installation which means you need to know the basics if you are to really get the most out of using ASP.

If you know HTML, or at least have looked at any HTML code, you will know that you can embed scripts in it; VB Script and Java Script are prime examples. Well, ASP script can be embedded within an HTML document. This makes life a lot easier, because we don't have to rewrite all of our web sites in another language. ASP is really like using VB Script to interact with databases (well, mainly with databases).

OK. ASP script is always found inside these tags: <% ASP CODE %> Your ASP code can span multiple lines, or can just be a few characters long. Anyway, getting back to using ASP and ADO. If you have ever programmed with the DAO (Data Access Objects) object model then you shouldn't find it too difficult to use ADO (well, for the basic features anyway).

The main objects that you will be using in your ASP code are the Connection and Recordset objects. You use the CreateObject method to create a connection object. You will need a local Data Source Name (DSN) connection on the web server to your database, because you need to pass the DSN when you connect to the database. Other than that, the Recordset object is quite simple. The BOF and EOF (Beginning Of File and End Of File) properties can be used for loops, and that is about it.

Page 2 of 4

This article was originally published on November 20, 2002

Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

Thanks for your registration, follow us on our social networks to keep up-to-date