参数太少。预期1。 [英] Too few parameters. Expected 1.
问题描述
我已经阅读了这个错误意味着什么,你有来自
选择语句的无效列名,拼写错误等等。
以下是两者的摘录我的页面,不知道为什么我收到这个错误
仍然。
----------------- -------------------------------------------------- ---------
-
strsql =" select * from Printers where PrinterName<> ''N / A''"
设置Conn = Server.CreateObject(" ADODB.Connection")
DSNtest =" DRIVER = { Microsoft Access驱动程序(* .mdb)};
DSNtest = dsntest& " DBQ = QUOT; &安培; Server.MapPath(" / database / sa inventory.mdb")
Conn.Open DSNtest
设置rs = Server.CreateObject(" ADODB。 Recordset)
rs.Open strsql,conn,3,3
----------------- -------------------------------------------------- ---------
-
然后我将这些数据发送到npResults2页面
response.write < TD BORDER = 1 ALIGN = CENTER WIDTH = 50> &安培; vbcrlf
response.write"< A target =''myNewWin''HREF =''npResults2.asp?pn =" &
rs(" PrinterName")& "''>编辑< / a>"
response.write"< / TD>" &安培; vbcrlf
----------------------------------------- -----------------------------------
-
iSerial = Request.QueryString(" pn")
strSQL =" SELECT * FROM printers WHERE PrinterName =" &安培; iSerial& ""
设置Conn = Server.CreateObject(" ADODB.Connection")
DSNtest =" DRIVER = {Microsoft Access Driver( * .mdb)中};
DSNtest = dsntest& " DBQ = QUOT; &安培; Server.MapPath(" / database / sa inventory.mdb")
Conn.Open DSNtest
设置rs = Server.CreateObject(" ADODB。 Recordset)
rs.Open strsql,conn,3,3
非常感谢任何帮助。
I have read what this error means, you have invalid column names from the
select statement, misspelling etc.
Here is an excerpt from both my pages, not sure why I am getting this error
still.
----------------------------------------------------------------------------
-
strsql = "select * from Printers where PrinterName <> ''N/A''"
Set Conn = Server.CreateObject("ADODB.Connection")
DSNtest="DRIVER={Microsoft Access Driver (*.mdb)}; "
DSNtest=dsntest & "DBQ=" & Server.MapPath("/database/sa inventory.mdb")
Conn.Open DSNtest
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open strsql, conn, 3,3
----------------------------------------------------------------------------
-
I then send this data to the npResults2 page
response.write "<TD BORDER=1 ALIGN=CENTER WIDTH=50>" & vbcrlf
response.write "<A target=''myNewWin'' HREF=''npResults2.asp?pn=" &
rs("PrinterName")& "''>Edit</a>"
response.write "</TD>" & vbcrlf
----------------------------------------------------------------------------
-
iSerial = Request.QueryString("pn")
strSQL = "SELECT * FROM printers WHERE PrinterName=" & iSerial & ";"
Set Conn = Server.CreateObject("ADODB.Connection")
DSNtest="DRIVER={Microsoft Access Driver (*.mdb)}; "
DSNtest=dsntest & "DBQ=" & Server.MapPath("/database/sa inventory.mdb")
Conn.Open DSNtest
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open strsql, conn, 3,3
Any help is much appreciated.
推荐答案
DVan写道:
我已经阅读了这个错误的含义,你的选择语句中有无效的列名,拼写错误等等。
这是我的两个页面的摘录,不知道为什么我仍然会收到这个
错误。
--------------- -------------------------------------------------- ---------
- -
strsql =" select * from Printers,其中PrinterName<> N / A"
当您使用Access
查询构建器测试时,此sql语句是否正常运行?
设置Conn = Server。 CreateObject(" ADODB.Connection")
DSNtest =" DRIVER = {Microsoft Access Driver(* .mdb)}; "
http://www.aspfaq。 com / show.asp?id = 2126
DSNtest = dsntest& " DBQ = QUOT; &安培; Server.MapPath(" / database / sa
inventory.mdb")
I have read what this error means, you have invalid column names from
the select statement, misspelling etc.
Here is an excerpt from both my pages, not sure why I am getting this
error still.
-------------------------------------------------------------------------- -- -
strsql = "select * from Printers where PrinterName <> ''N/A''"
Does this sql statement run without error when you test it using the Access
Query Builder?
Set Conn = Server.CreateObject("ADODB.Connection")
DSNtest="DRIVER={Microsoft Access Driver (*.mdb)}; "
http://www.aspfaq.com/show.asp?id=2126
DSNtest=dsntest & "DBQ=" & Server.MapPath("/database/sa
inventory.mdb")
是否
响应。写Server.MapPath(" / database / sa inventory.mdb")
显示数据库的正确路径?
Bob Barrows
-
Microsoft MVP - ASP / ASP.NET
请回复新闻组。我的From
标题中列出的电子邮件帐户是我的垃圾邮件陷阱,因此我不经常检查它。通过发布到新闻组,您将获得更快的回复。
Does
Response.Write Server.MapPath("/database/sa inventory.mdb")
display the correct path to your database?
Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don''t check it very often. You will get a
quicker response by posting to the newsgroup.
对于这两个问题都是,我有相同的脚本可以在另一个页面上工作。
我无法理解。
" Bob Barrows [MVP]" <再****** @ NOyahoo.SPAMcom>在消息中写道
news:em ************** @ TK2MSFTNGP09.phx.gbl ...
Yes to both questions, I have the same script that works on another page.
I can''t figure it out.
"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:em**************@TK2MSFTNGP09.phx.gbl...
DVan写道:
我已经阅读了这个错误的含义,你的选择语句中有无效的列名,拼写错误等等。
这是我的两个页面的摘录,不确定为什么我仍然会收到这个
错误。
------------------------------ --------------------------------------------
-
I have read what this error means, you have invalid column names from
the select statement, misspelling etc.
Here is an excerpt from both my pages, not sure why I am getting this
error still.
--------------------------------------------------------------------------
--
-
strsql =" select * from Printers where PrinterName<> ''N / A''"
-
strsql = "select * from Printers where PrinterName <> ''N/A''"
使用
Does this sql statement run without error when you test it using the
访问查询生成器测试时,此sql语句是否正常运行?
Access Query Builder?
设置Conn = Server.CreateObject(" ADODB.Connection")
DSNtest =" DRIVER = {Microsoft Access Driver(* .mdb)} ;
Set Conn = Server.CreateObject("ADODB.Connection")
DSNtest="DRIVER={Microsoft Access Driver (*.mdb)}; "
http: //www.aspfaq.com/show.asp?id=2126
DSNtest = dsntest& " DBQ = QUOT; &安培; Server.MapPath(" / database / sa
inventory.mdb")
DSNtest=dsntest & "DBQ=" & Server.MapPath("/database/sa
inventory.mdb")
Response.Write Server.MapPath(" / database / sa inventory.mdb")
显示数据库的正确路径?
Bob Barrows
-
Microsoft MVP - ASP / ASP.NET
请回复新闻组。我的From
标题中列出的电子邮件帐户是我的垃圾邮件陷阱,因此我不经常检查它。您将通过发布到新闻组获得更快的回复。
Does
Response.Write Server.MapPath("/database/sa inventory.mdb")
display the correct path to your database?
Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don''t check it very often. You will get a
quicker response by posting to the newsgroup.
PrinterName是基于文本的列类型吗?如果是这样,你需要用''字符来界定
数据。
函数sIn(s)
sIn =" ; '' " &安培;替换(s,,,和&; "''"
结束功能
sSQL =" SELECT * FROM Printers WHERE PrinterName = sIn(iSerial)
>
Ray在工作
" DVan" <峰; dt ******* @ yahoo.com>在消息中写道
news:Op ************** @ TK2MSFTNGP12.phx.gbl ...
Is PrinterName a text-based column type? If so, you need to delimit the
data with '' characters.
Function sIn(s)
sIn = "''" & Replace(s, "''", "''''") & "''"
End Function
sSQL = "SELECT * FROM Printers WHERE PrinterName = sIn(iSerial)
Ray at work
"DVan" <dt*******@yahoo.com> wrote in message
news:Op**************@TK2MSFTNGP12.phx.gbl...
对这两个问题都是,我有相同的脚本可以在另一页上工作。
我无法弄明白。
" Bob Barrows [MVP]" <再****** @ NOyahoo.SPAMcom>在消息中写道
新闻:em ************** @ TK2MSFTNGP09.phx.gbl ...
Yes to both questions, I have the same script that works on another page.
I can''t figure it out.
"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:em**************@TK2MSFTNGP09.phx.gbl...
DVan写道:
>我已经阅读了这个错误的含义,你有无效的列名来自
>选择声明,拼写错误等
>
>以下是我的两个页面的摘录,不确定wh
> I have read what this error means, you have invalid column names from
> the select statement, misspelling etc.
>
> Here is an excerpt from both my pages, not sure wh
这篇关于参数太少。预期1。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!