请求高手回答我的问题..asp的问题

来源:百度知道 编辑:UC知道 时间:2024/05/21 22:35:36
<%@LANGUAGE="VBSCRIPT"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
<a href="lookhomework.asp"?new=false>查看所有记录</a>
<a href="lookhomework.asp">查看新记录</a>
<%
dim username
username=session("curuser")
if username="" then
response.write"没有登陆,不能做练习,请<a href=zuoyelogin.html>登录</a>"
response.End

这种问题一般都是SQL语句的问题:
if request("new")<>false then
strquery="select * from [key] where username='" & username & "'order by date"
else
strquery="select * from [key] where username='" & username & "' and snew=ture order by date"
end if
建议你把rst.open strquery,conn,1,1删除了.
把下面的关于rst的查询也删除了.
打印response.write(strquery)来测试下你的SQL语句是否正确.

<%
dim conn
dim dbpath
set conn=server.createobject("adodb.connection")
DBPath = Server.MapPath("数据库所在文件夹/数据库名.mdb")
conn.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & DBPath
%>

看看这个语句:
strquery="select * from [key] where username='" & username & "'order by date" 注意order前面留个空格,再试试看;

你没有连接数据库。
加上链接数据库文件就行了~

你打开数据库的时候写的不对
把这句
conn.open strprovider,str
改成
conn.open str