当前位置: 首页 > 图文教程 > 数据库 > MYSQL > ASP连接MySQL数据库的方法

MYSQL
Windows 2003搭建Apache PHP MySQL环境经验分享
PHP环境配置IIS5.0+PHP5.23+MYSQL5+phpMyAdmin
详解用phpmyadmin建立MYSQL数据库的过程
几条常见的数据库分页 SQL 语句
将MySQL数据导入到Sql Server中
解决MySQL数据库中文模糊检索问题
MySQL索引分析和优化
提高MySQL查询效率的三个有效的尝试
MySQL查询不含周末的五天前的日期
连接MySQL数据库失败频繁的原因分析
SQL Server和MySQL的安全性分析
Linux搭建Discuz论坛的方法
如何保护MySQL中的重要数据
怎样把你的 MySQL 完全中文化
FreeBSD 6.2快速架设网站服务器教程
Oracle限制返回结果集的大小
MySQL中与浮点比较有关问题的解决
distinct在mysql中查询多条不重复记录值的解决办法
全面提升Linux服务器的安全
不能通过mysql.sock连接MySQL问题的方法

MYSQL 中的 ASP连接MySQL数据库的方法


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-10-17   浏览: 77 ::
收藏到网摘: n/a

<%
'测试读取MySql数据库的内容

strconnection="driver={mysql odbc 3.51 driver};database=weste_net;server=localhost;uid=root;password="
'无需配置dsn
set adodataconn = server.createobject("adodb.connection")
adodataconn.open strconnection

strquery = "select * from News"
set rs = adodataconn.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("News_id")%></td>
<td><%=rs("News_Title")%></td>
</tr>
<%
rs.movenext
loop
%>
</table>
<%
else
response.write("无数据.")
end if
rs.close
adodataconn.close
set adodataconn = nothing
set rsemaildata = nothing
%>

PS:若想直接使用以上代码,请将全角符号“<>”替换成半角符号“<>”。