Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error: Too few parameters. Expected 2.

Status
Not open for further replies.

daph

Programmer
Jun 9, 2000
65
CA
Hey everyone,

Well, I just started programming in ASP (With Access DB) and I have a little dilemma here. I have this error in some of my pages:

Provider for ODBC Drivers error '80040e10'
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 2.
/tenderpaws/testing/list.asp, line 19

What really gets to me is that MOST of the time, it works perfectly. But once in a while, the error will appear. I've been told that it's usually because a wrong field name is used. But I checked that...besides, it wouldn't work at all if that was the case, right?

There are a couple of things that I think could give me some hard time...but I'm not sure. First of all, are the queries case-sensitive in ASP? I did queries before in PLSQL with an Oracle DB, and it didn't matter if I wrote the field names in lower or upper case letters. The other thing that may cause a problem is that I'm doing something like this:

strSQL = "SELECT DISTINCT MOVIES.MOVIE_CD, TITLE
FROM MOVIES ORDER BY MOVIES.MOVIE_CD DESC"

Set rsSQL = objDBConn.Execute(strSQL)

For intCounter = 1 to 5
strSQLRating = "SELECT SUM(RATING) AS SUM_RATING
FROM RATINGS_MOVIES
WHERE MOVIE_CD = " & rsSQL("MOVIE_CD").Value

Set rsSQLRating = objDBConn.Execute(strSQLRating)

...

Set rsSQLRating = Nothing
rsSQL.MoveNext

Next

Would the value rsSQL("MOVIE_CD").Value return an integer if that is the type of the field in the table?

Well, if anyone can help me at all, I would greatly appreciate it. If there are any questions about my problem, I'll be happy to clarify.

Thanks a bunch guys!
Daph

 
[tt]

This error is due to one of the following things:

1. A field name was spelled incorrectly.
2. One or more of the values was blank.
3. You tried to insert the wrong datatype (e.g. surrounded a numeric value with quotes).

To troubleshoot this, response.write your SQL statement... make sure there is data for all params you are passing, and compare field names directly with those in the table. Also copy this SQL statement and execute it directly in the database, if the error message and the response.write statement aren't already giving you enough information.
[tt]"A Successful man is one who can build
a firm foundation with the bricks
that others throw at him"
[/tt]

banana.gif
rockband.gif
banana.gif
 

1. Well, like I explained before, the fields are written correctly. Is it case-sensitive?
2. What values are you talking about? The values that I am using in my WHERE clause?
3. This is why I was asking if rsSQL("MOVIE_CD").Value returns an integer if that is the type of the field in the table. Does it?

As for printing in Response.Write, it doesn't help at all...it looks all fine on the screen. And it's not the query itself that's the problem. I think it has to do with the variables I'm using. And like I said before, most of the time it works.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top