至少一个参数没有被指定值。

2025-05-02 21:56:57
推荐回答(4个)
回答(1):

帮你指出几个问题,自己解决:
1、以数字、内置函数作为字段名时,查询语句中应在该字段前后加上[],否则将出错。
2、字段1的类型为字符串,查询时其条件前后应加单引号。
综合1、2:
sql="select * from t1 where 1 = "&Title&" "
应修改为:
sql="select * from t1 where [1] = '" & Title & "'"
根据你的程序,大概应进一步修改为:
sql="select * from t1 where [1] = 'Title'"
3、当查询没有结果时,不能进行调用、修改,下面的语句:
if rs.eof and rs.bof then
rs("1") = "失败"
rs.update
set rs=nothing
end if
当rs.eof and rs.bof时,不能进行rs("1") = "失败"和rs.update
4、当对象关闭或清除后,不能再继续操作:
还是上面的语句:在if语句内set rs=nothing后,end if后就不能再rs.close、set rs=nothing了。
综合3、4和你的问题补充,应做如下修改:
if rs.eof then'去掉and rs.bof ,bof一般应用于MovePrevious时
rs.addnew
rs("1") = "Title"
rs.update
'set rs=nothing去掉此句
end if
可进一步简化为:
If rs.EOF Then conn.Execute "insert into t1 ([1]) values ('Title')"
多琢磨一下,你的程序还可进一步简化。

回答(2):

1.首先打开数据库。

2.然后在创建中选择querydesign按钮。

3.打开设计对话框,选择tScore并双击。

4.然后双击内容,将其添加到条件区域。

5. 然后在条件区域输入>[prompt],注意[]是参数查询的代表。

6.点击“运行”按钮弹出对话框。输入相应的值60。一旦设置成功,重新输入数据库,就不会再提示您输入错误。

回答(3):

sql="select * from t1 where 1 = "&Title&" "
看rs("1") = "失败",1字段的数据类型是字符串型,而sql语句中字段1的赋值是数字型,所以应该是:

sql="select * from t1 where 1 = '" & Title & "' ",加单引号!
注意:& 二边必须有空格!!

回答(4):

sql="select * from t1 where 1 = "&Title&" "
改为:
sql="select * from [t1] where [1] = "&Title&" "

你是用1作字段名?