<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<% 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
%>
本文档提供了一个使用ASP技术从MySQL数据库中检索新闻条目的示例代码。该示例展示了如何通过ODBC连接到本地服务器上的MySQL数据库,并执行SQL查询来获取新闻表中的所有记录。每条记录包括ID和新闻标题等字段。
7628

被折叠的 条评论
为什么被折叠?



