'80040e10错误:没有给出一个或多个必需参数的值 [英] '80040e10 Error: No value given for one or more required parameters

查看:72
本文介绍了'80040e10错误:没有给出一个或多个必需参数的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用MS

Access 2003数据库的ASP 3.0页面上间歇性地得到上述错误。


我已广泛搜索Google并找到了以下可能的原因

此错误:


字段名称拼写错误。

一个或多个值为空。

您试图插入错误的数据类型(例如用

引号包围数值,或者忘记在字符串周围加上引号)。

大写/拼写


然而,这些似乎都不是我问题的原因。

正如你在下面看到的,我是没有传递参数,我的数据访问语句

是一个不合格的SELECT


我已经写出了连接字符串和sql到页面,它们出现了

罚款。


附件是我的代码摘要。有没有人知道为什么这是间歇性地发生了?b / b
在global.asa:


Sub Application_onStart ()


Application.Lock


sCn_App =" PROVIDER = MICROSOFT.JET.OLEDB.4.0; " &安培; _

" DATA SOURCE = e:\inetpub \clients \ frickcpa.com\fpdb\tvom.m db"


申请表.Contents.Item(" cn_App")= sCn_App


Application.UnLock


End Sub


在ASP页面中:


<%


Dim sql,rs


Dim cn

设置cn = Server.CreateObject(" ADODB.Connection")

cn.open应用程序(" cn_App")

sql =" SELECT questionid,question,Hint_Image FROM question"


设置rs = Server.CreateObject(" ADODB.recordset")


随着rs

.ActiveConnection = cn

.source = sql

。打开< ---错误在这里第132行

结束时

请不要rs.eof


.....


rs.movenext


循环


如果rs.State那么

rs.close

set rs = nothing

如果

如果是cn.State那么

cn.Close

结束如果


%>


解决方案

嗨Dave,


从您的描述中,您丢失了一些参数

运行使用ADO对象查询数据库的ASP页面时出现相关错误,对吗?


如前所述,错误发生在以下几行


>>>>>>>>>> >



使用rs

.ActiveConnection = cn

.source = sql

。打开< ---第132行错误

结束

<<<<<<< <<<<


我认为RecordSet.Open方法可能需要一些参数。

我建议你尝试供应一些通过开放的属性方法

(如下面的参考文献所述)看它是否有效:


#ADO Open方法
http://www.w3schools.com/ado/met_rs_open.asp


此致,

Steven Cheng


Microsoft MSDN在线支持主管


================================================= =


通过电子邮件收到我的帖子通知?请参阅
http://msdn.microsoft .com / subscripti ... ult.aspx#notif

ications。


注意:MSDN托管新闻组支持服务是针对非紧急问题

如果社区或微软支持人员在1个工作日内做出初步回复是可以接受的。请注意,每个跟随

的响应可能需要大约2个工作日作为支持

专业人士与您合作可能需要进一步调查才能达到

最有效的分辨率。该产品不适用于需要紧急,实时或基于电话的交互或复杂的b $ b项目分析和转储分析问题的情况。这种性质的问题最好通过联系

Microsoft客户支持服务(CSS)处理
href =http://msdn.microsoft.com/subscriptions/support/default.aspx\"target =_ blank> http://msdn.microsoft.com/subscripti...t/default.aspx


==================================== ==============

此帖子按原样提供。没有保证,也没有赋予任何权利。


" Dave" < da ******* @ newsgroup.nospamwrote in message

news:ug ************** @ TK2MSFTNGP03.phx.gbl ...


我使用



MS $ b $间接使用ASP 3.0页面得到上述错误b


Access 2003数据库。


我已经广泛搜索了Google并发现了以下可能原因

for this错误:


字段名称拼写不正确。

一个或多个值为空。

您试图插入错误的数据类型(例如包围一个数值



with


引用,或者忘了在周围加上引号一个字符串)。

资本化/拼写


但是,这些似乎都不是我问题的原因。

如下所示,我没有传递参数,我的数据访问



state


是一个不合格的SELECT


我写了连接字符串和sql到页面,他们



出现


罚款。


附件是我的摘要码。有没有人知道为什么这是间歇性地发生了?b / b
在global.asa:


Sub Application_onStart ()


Application.Lock


sCn_App =" PROVIDER = MICROSOFT.JET.OLEDB.4.0; " &安培; _

" DATA SOURCE = e:\inetpub \clients \ frickcpa.com\fpdb\tvom.m db"


申请表.Contents.Item(" cn_App")= sCn_App


Application.UnLock


End Sub


在ASP页面中:


<%


Dim sql,rs


Dim cn

设置cn = Server.CreateObject(" ADODB.Connection")

cn.open应用程序(" cn_App")


sql =" SELECT questionid,question,Hint_Image FROM question"


设置rs = Server.CreateObject(" ADODB.recordset")

>
随着rs

.ActiveConnection = cn

.source = sql

。打开< ---这里出错了132

结束


请不要rs.eof


.....


rs.movenext


循环


如果rs.State那么

rs .close

设定rs =没有

结束如果


如果cn.State那么

cn.Close

结束如果


%>



您确定提供的字段名称实际存在于名为
$的表中b $ b问题?

通常,JET假定在查询表中的

字段中找不到的标识符是参数。因此,你的

字段列表中的拼写错误会导致此错误。


-

Anthony Jones - MVP ASP / ASP .NET


Dave写道:


我在ASP 3.0页面上间歇性地得到上述错误

使用MS Access 2003数据库。


我已广泛搜索Google并发现以下可能

导致此错误:


字段名称拼写不正确。

一个或多个值为空。

您试图插入错误的数据类型(例如用引号括起数字

值,或忘记在字符串周围加上引号。



如果你使用我的经常建议来使用

参数而不是动态sql,那么最后一个不是问题:
http:// groups -beta.google.com/group/...e36562fee7804e


就个人而言,我更喜欢使用存储过程或保存的参数查询

as

他们在Access中是众所周知的:


访问:
http://www.google。 com / groups?hl = en& l ... TNGP12.phx.gbl

http://groups.google.com/groups?hl = e ... tngp13.phx.gbl


资本化/拼写



JetSQL不区分大小写,因此大写永远不会成为问题


>



添加另一个:

您在表格设计中使用了保留关键字。在您的情况下,这似乎不是这样的情况,但是围绕表格并且用括号[]来$ / b $ b $字段名称来查看是否可以解决错误。如果是的话,

那么这就是要弄清楚保留哪个单词的问题。这有助于:
http://www.aspfaq。 com / show.asp?id = 2080


但是,这些似乎都不是我问题的原因。

正如你在下面看到的,我没有传递参数,我的数据访问

语句是一个不合格的SELECT


我已写出来了连接字符串和sql到页面,他们

看起来很好。



您需要通过尝试使用

访问查询生成器在Access中运行它来验证sql


>

附件是我的代码摘要。有谁知道为什么这个

是间歇性的?



间歇?通常这个错误是不变的,除非你动态地构建一个sql语句。
。 ...


>



< snip>


Dim sql,rs

sql =" SELECT questionid,question,Hint_Image FROM question"


设置rs = Server.CreateObject(" ADODB.recordset")

使用rs

.ActiveConnection = cn


可能与你的问题无关,但这应该是:


Set .ActiveConnection = cn


或者,在Open语句中传递连接对象:

..Open,cn


.source = sql

。打开< ---错误在这里132行



对于史蒂文的观点,你应该总是使用Open方法'<选项>

参数指定命令类型(再次,与您的错误无关)


..Open ,,,, 1''1 = adCmdText


我在这里看不到任何可能导致此错误的内容。你在向我们展示

你真正的代码吗?难道你的实际代码是动态构建一个

sql语句吗?


-

Microsoft MVP - ASP / ASP .NET

请回复新闻组。这个电子邮件帐户是我的垃圾邮件陷阱所以我

不经常检查它。如果您必须离线回复,请删除

无垃圾邮件


I am getting the error above intermittantly with an ASP 3.0 page using an MS
Access 2003 database.

I have searched Google extensively and found the following possible causes
for this error:

A field name was spelled incorrectly.
One or more of the values was blank.
You tried to insert the wrong datatype (e.g. surrounded a numeric value with
quotes, or forgot to put quotes around a string).
Capitalization /spelling

However, none of these seem to be the cause of my problem.

As you can see below, I am not passing parameters, my data access statement
is an unqualified SELECT

I have written out the connection string and sql to the page and they appear
fine.

Attached is a summary of my code. Does anyone have any idea why this is
intermittantly occurring?

In global.asa:

Sub Application_onStart()

Application.Lock

sCn_App= "PROVIDER=MICROSOFT.JET.OLEDB.4.0; " & _
"DATA SOURCE=e:\inetpub\clients\frickcpa.com\fpdb\tvom.m db"

Application.Contents.Item("cn_App")=sCn_App

Application.UnLock

End Sub

In ASP page:

<%

Dim sql,rs

Dim cn
Set cn = Server.CreateObject("ADODB.Connection")
cn.open Application("cn_App")
sql="SELECT questionid, question, Hint_Image FROM question"

Set rs = Server.CreateObject("ADODB.recordset")

With rs
.ActiveConnection=cn
.source=sql
.Open <---Error here at line 132
End With
Do while not rs.eof

.....

rs.movenext

Loop

If rs.State Then
rs.close
set rs=nothing
End if
If cn.State Then
cn.Close
End If

%>


解决方案

Hi Dave,

From your description, you got some parameter missing related error when
running an ASP page that use ADO objects to query database, correct?

As you mentioned that the error occur at the following lines

>>>>>>>>>>>

With rs
.ActiveConnection=cn
.source=sql
.Open <---Error here at line 132
End With
<<<<<<<<<<

I think it is possible that RecordSet.Open method require some parameters.
I suggest you try supply some of the properties through the "Open" method
(as mentioned in the following reference) to see whether it works:

#ADO Open Method
http://www.w3schools.com/ado/met_rs_open.asp

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.

==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.


"Dave" <da*******@newsgroup.nospamwrote in message
news:ug**************@TK2MSFTNGP03.phx.gbl...

I am getting the error above intermittantly with an ASP 3.0 page using an

MS

Access 2003 database.

I have searched Google extensively and found the following possible causes
for this error:

A field name was spelled incorrectly.
One or more of the values was blank.
You tried to insert the wrong datatype (e.g. surrounded a numeric value

with

quotes, or forgot to put quotes around a string).
Capitalization /spelling

However, none of these seem to be the cause of my problem.

As you can see below, I am not passing parameters, my data access

statement

is an unqualified SELECT

I have written out the connection string and sql to the page and they

appear

fine.

Attached is a summary of my code. Does anyone have any idea why this is
intermittantly occurring?

In global.asa:

Sub Application_onStart()

Application.Lock

sCn_App= "PROVIDER=MICROSOFT.JET.OLEDB.4.0; " & _
"DATA SOURCE=e:\inetpub\clients\frickcpa.com\fpdb\tvom.m db"

Application.Contents.Item("cn_App")=sCn_App

Application.UnLock

End Sub

In ASP page:

<%

Dim sql,rs

Dim cn
Set cn = Server.CreateObject("ADODB.Connection")
cn.open Application("cn_App")
sql="SELECT questionid, question, Hint_Image FROM question"

Set rs = Server.CreateObject("ADODB.recordset")

With rs
.ActiveConnection=cn
.source=sql
.Open <---Error here at line 132
End With
Do while not rs.eof

.....

rs.movenext

Loop

If rs.State Then
rs.close
set rs=nothing
End if
If cn.State Then
cn.Close
End If

%>

Are you sure the field names provided actually exist in a table called
question?
Typically JET assumes that an identifier that can''t be found amoungst the
fields in the tables in the query are parameters. Hence a typo in your
field list can result in this error.

--
Anthony Jones - MVP ASP/ASP.NET


Dave wrote:

I am getting the error above intermittantly with an ASP 3.0 page
using an MS Access 2003 database.

I have searched Google extensively and found the following possible
causes for this error:

A field name was spelled incorrectly.
One or more of the values was blank.
You tried to insert the wrong datatype (e.g. surrounded a numeric
value with quotes, or forgot to put quotes around a string).

This last one is not an issue if you take my oft-given advice to use
parameters rather than dynamic sql:
http://groups-beta.google.com/group/...e36562fee7804e

Personally, I prefer using stored procedures, or saved parameter queries
as
they are known in Access:

Access:
http://www.google.com/groups?hl=en&l...TNGP12.phx.gbl

http://groups.google.com/groups?hl=e...tngp13.phx.gbl

Capitalization /spelling

JetSQL is case-insensitive so capitalization will never be an issue

>

Add another one :
You''ve used a reserved keyword in your table design. This does not seem to
be the case in your situation, but it cannot hurt to surround the table and
field names with brackets [] to see if that resolves the error. If it does,
then it''s a matter of figuring out which word is reserved. This can help:
http://www.aspfaq.com/show.asp?id=2080)

However, none of these seem to be the cause of my problem.

As you can see below, I am not passing parameters, my data access
statement is an unqualified SELECT

I have written out the connection string and sql to the page and they
appear fine.

You need to verify the sql by attempting to run it in Access using the
Access Query Builder

>
Attached is a summary of my code. Does anyone have any idea why this
is intermittantly occurring?

Intermittent?? Typically this error is constant, unless you are dynamically
building a sql statement. ...

>

<snip>

Dim sql,rs
sql="SELECT questionid, question, Hint_Image FROM question"

Set rs = Server.CreateObject("ADODB.recordset")

With rs
.ActiveConnection=cn

Probably nothing to do with your problem, but this shoud be:

Set .ActiveConnection=cn

Alternatively, pass the connection object in the Open statement:
..Open ,cn

.source=sql
.Open <---Error here at line 132

To Steven''s point, you should always use the Open method''s <option>
argument to specify the command type (again, nothing to do with your error)

..Open ,,,,1 ''1=adCmdText

I really see nothing here that could cause this error. Are you showing us
your real code? Could it be that your actual code is dynamically building a
sql statement?

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don''t check it very often. If you must reply off-line, then remove the
"NO SPAM"


这篇关于'80040e10错误:没有给出一个或多个必需参数的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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