473,385 Members | 1,824 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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

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
8 1899
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
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
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
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
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
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
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
> 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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Robert Mark Bram | last post by:
Hi All! My ASP page below receives the following error: Error Type: Microsoft OLE DB Provider for ODBC Drivers (0x80040E10) Too few parameters. Expected 2. /polyprint/test.asp, line 31 ...
11
by: Andrew Thompson | last post by:
I have written a few scripts to parse the URL arguments and either list them or allow access to the value of any parameter by name. <http://www.physci.org/test/003url/index.html>...
3
by: Ryan Hubbard | last post by:
I would like to run a query from VBA. The query will be one with parameters. Is there a way to run the query and have Access prompt for the values like it does if I where to execute it through...
8
by: RC | last post by:
In my Access 2002 form, I have a combo box and on the AfterUpdate event I use DoCmd.RunSQL ("UPDATE .... to update records in a table. When it starts to run I get a message "You are about to...
1
by: bonnie.tangyn | last post by:
Hello all I get Too few parameters expected 2 error and "The MS Jet Database engine cannot find the input table or query "myTempTablename". Make sure it exists and that its name is spelled...
1
by: Richard Hollenbeck | last post by:
I wonder what I'm missing? I really feel like a retard because I've been screwing with some code for a very long time. I just must be missing something very simple. In the following example,...
4
by: HeislerKurt | last post by:
I'm getting the infamous error, "Too few parameters. Expected 2", when executing an update SQL statement in VBA. I assume it's a SQL syntax issue, but I can't find the problem, and I used a VBA...
1
by: javediq143 | last post by:
Hi all, I got one more prob in another ASP page linked to the earlier one. I've created an Access DB and created a query using Access Query wizard. The query is running fine in Access and it is...
1
by: TheGuyKnownAsY | last post by:
Hi everyone, I'm new here. My problem: the parameters that appear after rs.open when oppening the SQL connection. Microsoft OLE DB Provider for ODBC Drivers error '80040e10' Too few...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.