<%@ Language=VBScript %>
<html>
<head>
<title>MSSQL Test</title>
</head>
<body>
<center>
<%
'declare the variables
Dim Connection
Dim Recordset
Dim SQL

'declare the SQL statement that will query the database
SQL = "select * from dbo.Orders"

'create an instance of the ADO connection and recordset objects
Set Connection = Server.CreateObject("ADODB.Connection")
Set Recordset = Server.CreateObject("ADODB.Recordset")

'open the connection to the database
Connection.Open "Provider=sqloledb;Data Source=MSSQL;Initial Catalog=NorthWind;User Id=XXXXXXXXXXXX;Password=XXXXXXXXXXXXXX;"

'Open the recordset object executing the SQL statement and return records
Recordset.Open SQL,Connection

Response.Write "<table border=1 cellpadding=4>"
Response.Write "<tr>"


'first of all determine whether there are any records
If Recordset.EOF Then
Response.Write("No records returned.")
Else
'if there are records then loop through the fields
Do While NOT Recordset.Eof
Response.write "<td>" & Recordset("OrderID") & "</td>"
Response.write "<td>" & Recordset("CustomerID") & "</td>"
Response.write "<td>" & Recordset("EmployeeID") & "</td>"
Response.Write "</tr>"
Recordset.MoveNext
Loop
Response.Write "</table>"
End If
'close the connection and recordset objects to free up resources
Recordset.Close
Set Recordset=nothing
Connection.Close
Set Connection=nothing
%>
</center>
</body>
</html>