‘ LISTING 2: GetTitles.asp
<%@ LANGUAGE = VBScript %>
Using ADO to access _
SQL Server in an Active _
Server Page
Using ADO _
to access SQL Server in an _
Active Server Page
_
<%
Dim RSConnection, RSTitleList
Dim SQLQuery
‘BEGIN CALLOUT A
Set RSConnection = _
CreateObject _
("ADODB.Connection")
‘END CALLOUT A
‘BEGIN CALLOUT B
SQLQuery = "SELECT _
titles.title, titles.type, _
titles.price, _
authors.au_lname, "
SQLQuery = SQLQuery _
& "authors.au_fname _
FROM titles "
SQLQuery = SQLQuery & _
"INNER JOIN titleauthor _
ON titles.title_id = _
titleauthor.title_id "
SQLQuery = SQLQuery & _
"INNER JOIN authors _
ON titleauthor.au_id = _
authors.au_id "
SQLQuery = SQLQuery _
& "ORDER BY titles.title"
‘END CALLOUT B
Set RSTitleList = _
RSConnection.Execute(SQLQuery)
%>