哪位兄弟帮忙看看,是不是变量有问题!

来源:百度知道 编辑:UC知道 时间:2024/06/06 08:06:52
Microsoft OLE DB Provider for ODBC Drivers (0x80040E21)
ODBC 驱动程序不支持所需的属性。
/sitefiles2/web-content/showarticle.asp, 第 11 行

showarticle.asp如下:

<%@language="vbscript" codepage="65001"%>
<%
dim conn,xuhao
set conn = server.createobject("adodb.connection")
conn.open "readbook"
id_article=request.querystring("id_article")
xh=id_article
theday=request.querystring("theday")
set rsarticle = server.createobject("adodb.recordset")
sqlarticle = "Select * from [article] where id_article=xh"
rsarticle.open sqlarticle,conn,1,1
Session("theday") = theday
Session("title") = rsarticle("title")
Session("content") = rsarticle("content")
Session("datearticle") = rsarticle("date")
Session("hit_article") = rsarticle(

"Select * from [article] where id_article=xh"
如果xh是数字类型的改成
"Select * from [article] where id_article=" & xh
如果是字符类型的改成
"Select * from [article] where id_article='" & xh & "'"

还有conn.open "readbook" 是什么 这里不是写数据库连接字符串的吗
应该是conn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & server.mappath("数据库名") & ";Persist Security Info=False"

sqlarticle = "Select * from [article] where id_article='"&xh&"'"

用&来做连接符,你吧XH直接写入了SQL语句,系统怎么知道XH是个变量,

sqlarticle = "Select * from [article] where id_article='"&xh&"'"

用&来做连接符,你吧XH直接写入了SQL语句,系统怎么知道XH是个变量,

"Select * from [article] where id_article=xh"
如果xh是数字类型的改成
"Select * from [article] where id_article=" & xh
如果是字符类型的改成
"Select * from [article] where id_article='" & xh