数据库中,from 子语句出错,什么意思啊

来源:百度知道 编辑:UC知道 时间:2024/09/23 19:35:22
<!--#include file="checkadmin.asp"-->
<%
'连接数据库
database="vote.mdb"
strconn="provider=Microsoft.jet.oledb.4.0;data source="&server.mappath(database)
Set conn=server.CreateObject("ADODB.Connection")
conn.open strconn

'关闭数据库
Sub closeDB()
If IsObject(conn) Then
Set rs=Nothing
conn.close
Set conn=Nothing
End If
End sub
%>
<!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=gb231

user是保留字
[]要这个中括号括起来

rs.open "select * from user order by userID",conn,1,3

这句代码改成

rs.open "select * from [user] order by userID",conn,1,3

因为user是保留字,所以使用时要记得加上方括号。