加入收藏 | 设为首页 | 会员中心 | 我要投稿 常州站长网 (https://www.0519zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > Asp教程 > 正文

ASP程序如何直接连接MYSQL数据库

发布时间:2024-01-02 12:20:21 所属栏目:Asp教程 来源:DaWei
导读: 在网上查找大量资料,经过自己的不懈努力,终于测试成功了。原来要在服务器上安装mysql odbc 3.51 ,还有数据库用户名及密码,用下面的密码就可以了。

以下为引用的内容:
<%
strconne
在网上查找大量资料,经过自己的不懈努力,终于测试成功了。原来要在服务器上安装mysql odbc 3.51 ,还有数据库用户名及密码,用下面的密码就可以了。

以下为引用的内容:
<%
strconnection="driver={mysql odbc 3.51 driver};database=weste_net;server=localhost;uid=root;password="
set conn = server.createobject("adodb.connection")
conn.open strconnection

strquery = "select * from News"
set rs = conn.execute(strquery)
if not rs.bof then
%>

<table>
<tr>
<td<b>序列号</b></td>
<td><b>标题</b></td>
</tr>
<%
do while not rs.eof
%>
<tr>
<td><%=rs("id")%></td>
<td><%=rs("NTitle")%></td>
</tr>
<%
rs.movenext
loop
%>
</table>
<%
else
response.write("无暂时没有.")
end if
rs.close
conn.close
set conn = nothing
set rsdata = nothing
%>

(编辑:常州站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章