By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,083 Members | 2,237 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,083 IT Pros & Developers. It's quick & easy.

Too few parameters. Expected 1. - Problem with asp/access

P: n/a
I am using the following code in asp to select some data from an access db.
recSel is defined and set further up my webpage, as is rsUpdate User.
I cannot work out how to get past this error message
Too few parameters. Expected 1.
Can anyone see the problem?
strSQL = "SELECT tblUserDetails.UserRecId, tblUserDetails.UserName, " _
& "tblUserDetails.UserPw, tblUserDetails.UserEmailAddress, " _
& "tblUserDetails.UserFirstName, tblUserDetails.UserSurname, " _
& "tblUserDetails.UserPhoneNo, tblUserDetails.UserCompany " _
& "FROM tblUserDetails" _
& " WHERE tblUserDetails.UserName =" & recSel

rsUpdateUser.Open strSQL, adoCon, adOpenDynamic, adLockOptimistic
Jul 19 '05 #1
Share this Question
Share on Google+
8 Replies


P: n/a
Try and write the strSQL to screen and check it's output, then try nd run
this through your db tool (like access) as a query. This process might point
you in the direction of the problem (Like a field doesn't exist, or is of
the wrong type). As we can't see your db and it's contents it's tough to
tell you, the code itself looks pretty good.

Let us know how you get on.

Stu

"kbrad" <kb***@discussions.microsoft.com> wrote in message
news:BD**********************************@microsof t.com...
I am using the following code in asp to select some data from an access db. recSel is defined and set further up my webpage, as is rsUpdate User.
I cannot work out how to get past this error message
Too few parameters. Expected 1.
Can anyone see the problem?
strSQL = "SELECT tblUserDetails.UserRecId, tblUserDetails.UserName, " _
& "tblUserDetails.UserPw, tblUserDetails.UserEmailAddress, " _
& "tblUserDetails.UserFirstName, tblUserDetails.UserSurname, " _
& "tblUserDetails.UserPhoneNo, tblUserDetails.UserCompany " _
& "FROM tblUserDetails" _
& " WHERE tblUserDetails.UserName =" & recSel

rsUpdateUser.Open strSQL, adoCon, adOpenDynamic, adLockOptimistic

Jul 19 '05 #2

P: n/a
kbrad wrote:
I am using the following code in asp to select some data from an
access db. recSel is defined and set further up my webpage, as is
rsUpdate User.
I cannot work out how to get past this error message
Too few parameters. Expected 1.
This always means that a word exists in the query where a field or table
reference should be.
Can anyone see the problem?
strSQL = "SELECT tblUserDetails.UserRecId, tblUserDetails.UserName, "
_ & "tblUserDetails.UserPw, tblUserDetails.UserEmailAddress, " _
& "tblUserDetails.UserFirstName, tblUserDetails.UserSurname, " _
& "tblUserDetails.UserPhoneNo, tblUserDetails.UserCompany " _
& "FROM tblUserDetails" _
& " WHERE tblUserDetails.UserName =" & recSel


You cannot debug this without knowing what the actual sql statement is. The
only way to determine that is to response.write it. Show us the result of

Response.Write strSQL

UserName is probably a character (Text) field so you need to concatenate
delimiters around the filter value:

& " WHERE tblUserDetails.UserName ='" & recSel & "'"

Here are some previous posts I've made dealing with delimiters (and how to
avoid dealing with them):
http://www.google.com/groups?hl=en&l...TNGP12.phx.gbl
http://tinyurl.com/jyy0
http://www.google.com/groups?hl=en&l...%3D10%26sa%3DN
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.
Jul 19 '05 #3

P: n/a
Brilliant - so simple when you know how!!

I have another problem, now I'm getting this
Microsoft VBScript runtime error '800a000d'

Type mismatch: 'rsUserUpdate'
It related to this line of code which tries to put a value from the
recordset into a form.
<td><input name="firstname" type="text" maxlength="200" VALUE="<%
response.write rsUserUpdate("UserFirstName") %>"> </td>

Any ideas would be very welcome.
"Bob Barrows [MVP]" wrote:
kbrad wrote:
I am using the following code in asp to select some data from an
access db. recSel is defined and set further up my webpage, as is
rsUpdate User.
I cannot work out how to get past this error message
Too few parameters. Expected 1.


This always means that a word exists in the query where a field or table
reference should be.
Can anyone see the problem?
strSQL = "SELECT tblUserDetails.UserRecId, tblUserDetails.UserName, "
_ & "tblUserDetails.UserPw, tblUserDetails.UserEmailAddress, " _
& "tblUserDetails.UserFirstName, tblUserDetails.UserSurname, " _
& "tblUserDetails.UserPhoneNo, tblUserDetails.UserCompany " _
& "FROM tblUserDetails" _
& " WHERE tblUserDetails.UserName =" & recSel


You cannot debug this without knowing what the actual sql statement is. The
only way to determine that is to response.write it. Show us the result of

Response.Write strSQL

UserName is probably a character (Text) field so you need to concatenate
delimiters around the filter value:

& " WHERE tblUserDetails.UserName ='" & recSel & "'"

Here are some previous posts I've made dealing with delimiters (and how to
avoid dealing with them):
http://www.google.com/groups?hl=en&l...TNGP12.phx.gbl
http://tinyurl.com/jyy0
http://www.google.com/groups?hl=en&l...%3D10%26sa%3DN
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.

Jul 19 '05 #4

P: n/a
It probably contains Null. Do this:

response.write rsUserUpdate("UserFirstName") & ""

Bob Barrows
kbrad wrote:
I have another problem, now I'm getting this
Microsoft VBScript runtime error '800a000d'

Type mismatch: 'rsUserUpdate'
It related to this line of code which tries to put a value from the
recordset into a form.
<td><input name="firstname" type="text" maxlength="200" VALUE="<%
response.write rsUserUpdate("UserFirstName") %>"> </td>


--
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.
Jul 19 '05 #5

P: n/a
I don't understand this can you explain what the &"" is for?
I've tried it and get the same error.

"Bob Barrows [MVP]" wrote:
It probably contains Null. Do this:

response.write rsUserUpdate("UserFirstName") & ""

Bob Barrows
kbrad wrote:
I have another problem, now I'm getting this
Microsoft VBScript runtime error '800a000d'

Type mismatch: 'rsUserUpdate'
It related to this line of code which tries to put a value from the
recordset into a form.
<td><input name="firstname" type="text" maxlength="200" VALUE="<%
response.write rsUserUpdate("UserFirstName") %>"> </td>


--
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.

Jul 19 '05 #6

P: n/a
It's to append an empty string to the Null that was supposedly contained in
the recordset field, which I guess is not the case since you are still
getting the error. Without knowing what's in your recordset i really can't
help. Try looping through your recordset fields with this code to see if you
can see the problem:

for each fld in rsUserUpdate.Fields
Response.Write fld.Name & ": """ & fld.value & """<BR>"
next

Bob Barrows
kbrad wrote:
I don't understand this can you explain what the &"" is for?
I've tried it and get the same error.

"Bob Barrows [MVP]" wrote:
It probably contains Null. Do this:

response.write rsUserUpdate("UserFirstName") & ""

Bob Barrows
kbrad wrote:
I have another problem, now I'm getting this
Microsoft VBScript runtime error '800a000d'

Type mismatch: 'rsUserUpdate'
It related to this line of code which tries to put a value from the
recordset into a form.
<td><input name="firstname" type="text" maxlength="200" VALUE="<%
response.write rsUserUpdate("UserFirstName") %>"> </td>


--
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.


--
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.
Jul 19 '05 #7

P: n/a
Oh stupid me!!! It should be rsUpdateUser not rsUserUpdate -problem solved.
Thanks for you help with this and the original problem. Greatly appreciated.

"Bob Barrows [MVP]" wrote:
It's to append an empty string to the Null that was supposedly contained in
the recordset field, which I guess is not the case since you are still
getting the error. Without knowing what's in your recordset i really can't
help. Try looping through your recordset fields with this code to see if you
can see the problem:

for each fld in rsUserUpdate.Fields
Response.Write fld.Name & ": """ & fld.value & """<BR>"
next

Bob Barrows
kbrad wrote:
I don't understand this can you explain what the &"" is for?
I've tried it and get the same error.

"Bob Barrows [MVP]" wrote:
It probably contains Null. Do this:

response.write rsUserUpdate("UserFirstName") & ""

Bob Barrows
kbrad wrote:
I have another problem, now I'm getting this
Microsoft VBScript runtime error '800a000d'

Type mismatch: 'rsUserUpdate'
It related to this line of code which tries to put a value from the
recordset into a form.
<td><input name="firstname" type="text" maxlength="200" VALUE="<%
response.write rsUserUpdate("UserFirstName") %>"> </td>
--
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.


--
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.

Jul 19 '05 #8

P: n/a
> Oh stupid me!!! It should be rsUpdateUser not rsUserUpdate -problem
solved.

Why not just call it rs? Eliminates this problem...

--
http://www.aspfaq.com/
(Reverse address to reply.)
Jul 19 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.