newbie: ERROR No value given for one or more required parameters.

J

Jim Flaherty

Hello I get No value given for one or more required parameters.
on a page that updates a access 2000 db

code



set oASP = Server.CreateObject("ADODB.Connection")
oASP.Open _
"Provider=Microsoft.Jet.OLEDB.4.0;"&_
"Persist Security Info=TRUE;" &_
"Data Source=d:\inetpub\wwwroot\ttfkbnt\db1.mdb","Admin",""
'######################################################
' get survey info from DB
' #####################################################
sql2 = "UPDATE contacts set password1 = 'password' where num = " & num1
'response.write(sql2)
set rsPC = oASP.Execute(sql2)




the error line listed is the execute sql

any Ideas
Thanks
Jim
 
R

Ray at

You have a Response.write(sql2) line, which is good. Uncomment that and
comment the execute line. Then look at the query to see what's wrong.
Chances are, num1 doesn't have a value, and your query will look like

UPDATE contacts set password1 = 'password' where num =

After you get that fixed, change this line from:
Set rsPC = oASP.Execute(sql2)
to:
oASO.Execute sql2

There isn't any need to create a recordset when executing an UPDATE. Just
execute the UPDATE query, unless you need to get the "n rows affected"
message, which I don't even know if Access returns.

Ray at work
 
S

Stuart Palmer

I wonder if it could be something like updating a zero/null value for a
field that requires this a value. Check the values you are putting in are
there.

Stu
 
M

mark4asp

Hello I get No value given for one or more required parameters.
on a page that updates a access 2000 db

code



set oASP = Server.CreateObject("ADODB.Connection")
oASP.Open _
"Provider=Microsoft.Jet.OLEDB.4.0;"&_
"Persist Security Info=TRUE;" &_
"Data Source=d:\inetpub\wwwroot\ttfkbnt\db1.mdb","Admin",""
'######################################################
' get survey info from DB
' #####################################################
sql2 = "UPDATE contacts set password1 = 'password' where num = " & num1
'response.write(sql2)
set rsPC = oASP.Execute(sql2)




the error line listed is the execute sql

any Ideas
Thanks
Jim

I'm guessing that the problem could be that there is no value set for
num1 when the SQL is executed. If num1 should always be a positive
number you can do the following:

If isWholeNumber(num1) Then
set rsPC = oASP.Execute(sql2)
End If

Function isWholeNumber(numin)
Dim num
If isNumeric(numin) Then
If InStr(numin, ".") = 0 Then
num = Int(numin)
If num > 0 Then
isWholeNumber = True
Exit Function
End If
End If
End If
isWholeNumber = False
End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top