注册 登录
编程论坛 ASP技术论坛

or 的關係是不是這樣的寫的呢。!

xunmi_love 发布于 2007-12-17 11:42, 637 次点击
<%
     dim cxfj
     cxfj=request.form("guanjianzi")
     set conn=server.createobject("adodb.connection")
     conn.open"driver={microsoft access driver (*.mdb)};dbq="&server.mappath("data\gonggao.mdb")
     set rs=server.createobject("adodb.recordset")
      rs.open ("select * from tellist where bumen='"&cxfj&"' or danwei='"&cxfj&"' or name='"&cxfj&"' or fenji='"&cxfj&"'"),conn,1,1
     if rs.eof then
     response.write"sorry ! did not find anlything from your key"
     end if
     %>

執行的時候是錯誤,ODBC不支技!!!!
我那裡寫錯了呢!

[[italic] 本帖最后由 xunmi_love 于 2007-12-17 11:44 编辑 [/italic]]
2 回复
#2
gdk20062007-12-17 13:44
句的错误是什么!看看你单独的数据库连接,或者把代码改改:
rs.open ("select * from tellist where bumen='"&cxfj&"' or danwei='"&cxfj&"' or name='"&cxfj&"' or fenji='"&cxfj&"'"),conn,1,1




sql=("select * from tellist where bumen='"&cxfj&"' or danwei='"&cxfj&"' or name='"&cxfj&"' or fenji='"&cxfj&"' "
rs.open sql,conn,1,1
看看你的SQL语句!
#3
xunmi_love2007-12-17 13:59
我在access裡面執行了一下。
select * from tellist where name=cxfj or danwei=cxfj or bumen=cxfj or fenji=cxfj
然後會提示輸入cxfj的值!
輸入後可查。
樓上說的。我也試過了,不行!跟剛開始的一樣!
如果不加"&cxfj&",,,都不知道怎麼能cxfj當變量連接!!!
1