日期:2014-05-17  浏览次数:20925 次

刚学asp想请大侠帮忙看看
dim conn,rs,sqr1
set conn=Server.CreateObject("adodb.connection")
conn.Open "provider=microsoft.jet.oledb.4.0;data source=" & server.MapPath("news.mdb")
sqr1="select * from new1"
set rs=conn.Execute(sqr1)
%>
<table align="center" border="1">
<th>新闻标题</th>
<% 
do while not rs.eof
%>
<tr>
<td><a href="3.asp?no=<%=rs("id")%>">
<%=rs("title")%> </a>

</td>
</tr>
<%
rs.movenext
loop
%>
</table>
<hr>
'<%
'请在这里输入您的ASP代码
dim conn, rs,sqr1
set conn=Server.CreateObject("adodb.connection")
conn.Open= "provider=microsoft.jet.oledb.4.0;data source=" & server.MapPath("news.mdb")
sqr1="select * from new2"
set rs=Server.Execute(sqr1)

%>
<table align="center">
<th>娱乐</th>
<%do while not rs.eof%>
<tr>
<td>
<a href="2.asp?no=<%=rs("id")%>"><%=rs("title")%></a>
</td>
</tr>
<%
rs.movenext
loop
%>
</table>
<%
'请在这里输入您的ASP代码
dim conn, rs,sqr1
set conn=Server.CreateObject("adodb.connection")
conn.Open= "provider=microsoft.jet.oledb.4.0;data source=" & server.MapPath("news.mdb")
sqr1="select * from new1"
set rs=Server.Execute(sqr1)

%>
<table align="right">
<th>教育<th>
<%do while not rs.eof%>
<tr>
<td>
<a href="1.asp?no=<%=rs("id")%>"><%=rs("title")%></a>
</td>
</tr>
<%
rs.movenext
loop
%>
</table>
<%
'请在这里输入您的ASP代码
dim conn, rs,sqr1
set conn=Server.CreateObject("adodb.connection")
conn.Open= "provider=microsoft.jet.oledb.4.0;data source=" & server.MapPath("news.mdb")
sqr1="select * from new1"
set rs=Server.Execute(sqr1)

%>
<table align="left" border="1">
<h1>科技</h1>
<%do while not rs.eof%>
<tr>
<td>
<a href="4.asp?no=<%=rs("id")%>"><%=rs("title")%></a>
</td>
</tr>
<%
rs.movenext
loop
%>
错误结论是
错误代码:dim conn, rs,sqr1
错误描述:名称重定义


------解决方案--------------------
名称重定义

------解决方案--------------------
dim conn, rs,sqr1
set conn=Server.CreateObject("adodb.connection")
conn.Open= "provider=microsoft.jet.oledb.4.0;data source=" & server.MapPath("news.mdb")
这段代码只写一次就行了,不用写3次,另外,建议你还是学asp.net吧,asp快要淘汰了
------解决方案--------------------
貌似写了4次
------解决方案--------------------
应该报名称4重定义的错误
------解决方案--------------------
重定义了
------解决方案--------------------
dim conn, rs,sqr1
set conn=Server.CreateObject("adodb.connection")
conn.Open= "provider=microsoft.www.mzty.com.jet.oledb.4.0;data source=" & server.MapPath("news.mdb")
这段代码只写一次就行了,不用写3次
------解决方案--------------------