ASP链接MYSQL并读取数据的程序
类别: ASP教程
<%
\'ASP链接MYSQL的程序
\'需要装MYSQLODBC驱动 下载地址http://www.mysql.com/downloads/api-myodbc-2.50.html
\'E-MAIL:Kaxue@Hotmail.com QQ:484110 HOMEPAGE:www.Flyday.net
\'整理时间:Thursday, May 23, 2002 5:54 PM WIN2000SERVER+IIS5 测式通过
strConnection = "dsn=user"
\'strconnection="DefaultDir=;Driver={myodbc driver};database=bbs"
Set adoDataConn = Server.CreateObject("ADODB.Connection")
adoDataConn.Open strConnection
strQuery = "SELECT * FROM user where username="kaxi""
Set rs= Server.CreateObject("ADODB.Recordset")
rs.open strQuery,strConnection,2,1
response.write rs.recordcount
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("对不起,没有找到您需要的数据")
End If
rs.Close
adoDataConn.Close
Set adoDataConn = Nothing
%>
\'ASP链接MYSQL的程序
\'需要装MYSQLODBC驱动 下载地址http://www.mysql.com/downloads/api-myodbc-2.50.html
\'E-MAIL:Kaxue@Hotmail.com QQ:484110 HOMEPAGE:www.Flyday.net
\'整理时间:Thursday, May 23, 2002 5:54 PM WIN2000SERVER+IIS5 测式通过
strConnection = "dsn=user"
\'strconnection="DefaultDir=;Driver={myodbc driver};database=bbs"
Set adoDataConn = Server.CreateObject("ADODB.Connection")
adoDataConn.Open strConnection
strQuery = "SELECT * FROM user where username="kaxi""
Set rs= Server.CreateObject("ADODB.Recordset")
rs.open strQuery,strConnection,2,1
response.write rs.recordcount
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("对不起,没有找到您需要的数据")
End If
rs.Close
adoDataConn.Close
Set adoDataConn = Nothing
%>
- 上一篇: 实现网页密码验证的两个基本方法
- 下一篇: ASP计数器设计详解-1
-= 资 源 教 程 =-
文 章 搜 索