简单(?)连接问题 [英] simple (?) connection problem

查看:61
本文介绍了简单(?)连接问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试从Access数据库中的值构建下拉列表,但不能
超过此错误。应该很容易,但是我不能让它工作。


首先,代码:

1.< select name =" Gift1" id =" Gift1">

< option value =""选择> -Select One-

<%Set RS = Server.CreateObject(" ADODB.Recordset")

strSQL =" SELECT GiftID,GiftDesc"

strSQL = strSQL& FROM Gift

strSQL = strSQL& 订购GiftDesc

RS.Open strSQL,conn

''set rs = objconnection.execute(strSQL)


而非RS.EOF

Response.Write"< option

value =''"& RS.Fields(" GiftID")&" ;''>"& RS.Fields(" GiftD esc")&"< / option>"

RS.MoveNext

WEND

RS.Close

设定RS =无

%>


< / select> ;

然后,我的include文件中的代码建立连接:


cst =" Provider = Microsoft.Jet.OLEDB.4.0; Data Source =

cst = cst& server.mappath(" shape.mdb")

set conn = Server.CreateObject(" ADODB.Connection")

conn.open cst


页面已成功连接以插入一些数据,所以我不认为
认为连接代码是坏的。我做错了什么?


Trying to build a dropdown from the values in an Access database, but can''t
get past this error. Should be easy, but I can''t make it work.

First, the code:
1. <select name="Gift1" id="Gift1">
<option value="" selected>-Select One-
<%Set RS = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT GiftID, GiftDesc "
strSQL = strSQL & "FROM Gift "
strSQL = strSQL & "ORDER BY GiftDesc"
RS.Open strSQL, conn
'' set rs = objconnection.execute(strSQL)

While Not RS.EOF
Response.Write "<option
value=''"&RS.Fields("GiftID")&"''>"&RS.Fields("GiftD esc")&"</option>"
RS.MoveNext
WEND
RS.Close
set RS = nothing
%>

</select>
Then, the code in my include file to establish connection:

cst = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
cst = cst & server.mappath("shape.mdb")
set conn = Server.CreateObject("ADODB.Connection")
conn.open cst

The page already has successfuly connected to insert some data, so I don''t
think the connection code is bad. What am I doing wrong?


推荐答案

忘记添加。,这是我得到的错误:


错误类型:

ADODB.Recordset(0x800A0BB9)

参数类型错误,超出可接受的范围,或者在

彼此冲突。

/grace/shape.asp,行117

其中117是:

RS.Open strSQL,conn
Forgot to add., this is the error I get:

Error Type:
ADODB.Recordset (0x800A0BB9)
Arguments are of the wrong type, are out of acceptable range, or are in
conflict with one another.
/grace/shape.asp, line 117
Where 117 is:
RS.Open strSQL, conn


什么

RESPONSE.WRITE STRSQL

RESPONSE.END


给你看?


或者,哪一行是117行?


雷在家


" middletree" < MI ******** @ htomail.com>在消息中写道

news:en ************** @ TK2MSFTNGP11.phx.gbl ...
What does
RESPONSE.WRITE STRSQL
RESPONSE.END

show you?

Or, which line is line 117?

Ray at home

"middletree" <mi********@htomail.com> wrote in message
news:en**************@TK2MSFTNGP11.phx.gbl...
忘记添加。,这是我得到的错误:

错误类型:
ADODB.Recordset(0x800A0BB9)
参数类型错误,超出可接受的范围,或者是
相互冲突。
/grace/shape.asp,第117行

其中117是:
RS.Open strSQL,conn
Forgot to add., this is the error I get:

Error Type:
ADODB.Recordset (0x800A0BB9)
Arguments are of the wrong type, are out of acceptable range, or are in
conflict with one another.
/grace/shape.asp, line 117
Where 117 is:
RS.Open strSQL, conn



糟糕。你告诉我们第117行是什么。


为什么你注释掉了set rs = objconnection.execute(strSQL)行?

我认为你应该使用它而不是RS.Open。​​


Ray在家里


" ; middletree" < MI ******** @ htomail.com>在消息中写道

news:en ************** @ TK2MSFTNGP11.phx.gbl ...
Oops. You told us what line 117 is.

Why did you comment out the "set rs = objconnection.execute(strSQL)" line?
I think you should use that instead of RS.Open.

Ray at home

"middletree" <mi********@htomail.com> wrote in message
news:en**************@TK2MSFTNGP11.phx.gbl...
忘记添加。,这是我得到的错误:

错误类型:
ADODB.Recordset(0x800A0BB9)
参数类型错误,超出可接受的范围,或者是
相互冲突。
/grace/shape.asp,第117行

其中117是:
RS.Open strSQL,conn
Forgot to add., this is the error I get:

Error Type:
ADODB.Recordset (0x800A0BB9)
Arguments are of the wrong type, are out of acceptable range, or are in
conflict with one another.
/grace/shape.asp, line 117
Where 117 is:
RS.Open strSQL, conn



这篇关于简单(?)连接问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆