1 <%
2 Dim cnnSimple ' ADO connection
3 Dim rstSimple ' ADO recordset
4 Set cnnSimple = Server.CreateObject("ADODB.Connection")
5 ' DSNLess
6 cnnSimple.Open "Provider=SQLOLEDB;Data Source=YOURDBSERVER;" _
7 & "Initial Catalog=YOURDBNAME;User Id=YOURUSERID;Password=YOURPASSWORD;" _
8 & "Connect Timeout=15;Network Library=dbmssocn;"
9 Set rstSimple = cnnSimple.Execute("SELECT * FROM tbltest")
10 %>
11 <P> Connecting to SQL DB with DSNless connection P>
12 <TABLE border=1><%
13 Do While Not rstSimple.EOF
14 %><TBODY><TR><TD><%= rstSimple.Fields("id").Value %>TD><TD>%>= rstSimple.Fields("name").Value %>TD>TR><%
15 rstSimple.MoveNext
16 Loop
17 %>TBODY>TABLE>
18 <%
19 rstSimple.Close
20 Set rstSimple = Nothing
21 cnnSimple.Close
22 Set cnnSimple = Nothing
23 %>
24
25