我做了一个asp循环,要把数据库里的题目循环出来,我是这样写的<%
<%SetConn=Server.CreateObject("ADODB.Connection")Conn.Open"DBQ="&Server.MapPath("data...
<%
Set Conn =Server.CreateObject("ADODB.Connection")
Conn.Open "DBQ=" & Server.MapPath("data/joke.mdb") & ";Driver={Microsoft Access Driver (*.mdb)}"
%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>title</title>
</head>
<body>
<table width="700" border="3" align="center" cellpadding="3" cellspacing="1" bordercolor="#FF0000">
<tr>
<%
SQL = "Select * From SMSTitle Where SMSTitle=" & SMSTitle
Set Rs = Conn.Execute(SQL)
<%Do While Rs.Eof=false%>
<%response.Write("SMSTitle")%>
<%rs.movenext
loop
%>
</body>
</html> 展开
Set Conn =Server.CreateObject("ADODB.Connection")
Conn.Open "DBQ=" & Server.MapPath("data/joke.mdb") & ";Driver={Microsoft Access Driver (*.mdb)}"
%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>title</title>
</head>
<body>
<table width="700" border="3" align="center" cellpadding="3" cellspacing="1" bordercolor="#FF0000">
<tr>
<%
SQL = "Select * From SMSTitle Where SMSTitle=" & SMSTitle
Set Rs = Conn.Execute(SQL)
<%Do While Rs.Eof=false%>
<%response.Write("SMSTitle")%>
<%rs.movenext
loop
%>
</body>
</html> 展开
3个回答
展开全部
<%
'连接Access
dim conn
dim dbpath
dbpath=server.mappath("data/joke.mdb")
set conn=server.createobject("adodb.connection")
conn.open "Provider=Microsoft.Jet.Oledb.4.0;Data Source="&dbpath
%>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>title</title>
</head>
<body>
<table width="700" border="3" align="center" cellpadding="3" cellspacing="1" bordercolor="#FF0000">
<tr>
<td>
<%
SMSTitle="XXX"'定义值或是
SMSTitle=request("SMSTitle")'接收值
SQL = "Select * From SMSTitle Where SMSTitle='" & SMSTitle &"'"
Set Rs = Conn.Execute(SQL)
Do While not rs.eof
response.Write rs("SMSTitle")
rs.movenext
loop
%>
</td>
</tr>
</table>
</body>
</html>
'连接Access
dim conn
dim dbpath
dbpath=server.mappath("data/joke.mdb")
set conn=server.createobject("adodb.connection")
conn.open "Provider=Microsoft.Jet.Oledb.4.0;Data Source="&dbpath
%>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>title</title>
</head>
<body>
<table width="700" border="3" align="center" cellpadding="3" cellspacing="1" bordercolor="#FF0000">
<tr>
<td>
<%
SMSTitle="XXX"'定义值或是
SMSTitle=request("SMSTitle")'接收值
SQL = "Select * From SMSTitle Where SMSTitle='" & SMSTitle &"'"
Set Rs = Conn.Execute(SQL)
Do While not rs.eof
response.Write rs("SMSTitle")
rs.movenext
loop
%>
</td>
</tr>
</table>
</body>
</html>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询