dcsimg
June 25, 2018
Hot Topics:

Using ASP with VB Components

  • November 19, 2002
  • By Sam Huggill
  • Send Email »
  • More Articles »

I will now take you through a sample ASP script that uses ADO to write the contents of a recordset to an HTML page. The first line is to create a connection object:

<%
Set Conn = Server.CreateObject("ADODB.Connection")

Now open a DSN, in this case People, and execute an SQL (Structured Query Language) query to create a recordset object:

Conn.Open("People")
Set RS = Conn.Execute("SELECT * FROM Persons")

Simple enough. We now need to iterate through all the records in the Persons table, and write then, in a very simple way, to the HTML page:

If Not RS.EOF Then
Do
Response.Write RS("PersonFName") & " " & RS("PersonLName")
RS.Movenext
Loop Until RS.EOF
End If

In the first line, we check that the table is not empty, and we then proceed to loop through the Persons table writing each PersonFName and PersonLName field to the HTML file. The Response.Write statement will write the information at the point where the ASP script is located. E.g. If above your ASP script you have header table, then the names will be written beneath that table.

Simple. But how can this help me in my Visual Basic development? Well, lets see.





Page 3 of 4



Comment and Contribute

 


(Maximum characters: 1200). You have characters left.

 

 


Enterprise Development Update

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

By submitting your information, you agree that developer.com may send you developer offers via email, phone and text message, as well as email offers about other products and services that developer believes may be of interest to you. developer will process your information in accordance with the Quinstreet Privacy Policy.

Sitemap

×
We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.
Thanks for your registration, follow us on our social networks to keep up-to-date