让ASP搭配MYSQL(2)
</TABLE>
<%
Else
Response.Write("Sorry, no data found.")
End If
rs.Close
adoDataConn.Close
Set adoDataConn = Nothing
Set rsEmailData = Nothing
%>
2. 不使用DSN
<%
strconnection="DefaultDir=;Driver={myodbc driver};database=admin"
Set adoDataConn = Server.CreateObject("ADODB.Connection")
adoDataConn.Open strConnection
strQuery = "SELECT * FROM user"
Set rs = adoDataConn.Execute(strQuery)
If Not rs.BOF Then
%>
<TABLE>
<TR>
<TD<b>username</b></TD>
<TD><b>password</b></TD>
</TR>
<%
Do While Not rs.EOF
%>
<TR>
<TD><%=rs("username")%></TD>
<TD><%=rs("password")%></TD>
</TR>
<%
rs.MoveNext
Loop
%>
</TABLE>
<%
Else
Response.Write("Sorry, no data found.")
End If
rs.Close
adoDataConn.Close
Set adoDataConn = Nothing
Set rsEmailData = Nothing
%>
内容版权声明:除非注明,否则皆为本站原创文章。