The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

[ODBC Microsoft Access Driver] Too few parameters. Expected 3.

I am getting the following error message from my
website on a page that works fine when I test it
with iss on my own computer. Also, another subroutine
(a login script), on the same asp page, using the
same connection object and an identically set up
recordset object works fine. So I don't see why it's
not working here. Is it because of my use of
aliases for field names in the sql query?

I asked support at my webhosting company and they
responded that there is an invalid field name
either in the where or orderby clauses.

But the entire query is cut and paste from the
access databse that it connects to. And the query
works fine on the identical db file on my own
computer both from within access and through
the adodb conncection.

Can someone please explain the meaning of the error
message? What parameters is server expecting?

I see what you mean. It would be easier to read. But the way I wrote it was fine by my server. I wrote it that way because I created the query in access and just cut and pasted the sql from access. That should be the most access-compatible sql syntax possible.

It just didn't work on the webhosting server. Are we talking about incorrect syntax that works on some "forgiving" servers and not others depending on how they are configured?

I hope I don't have to start worrying about cross-server compatibility for my asp scripts like we have to worry about cross browser compatibility for client side scripts.

As far as the error message is concerned, does it refer to a badly written sql string. It referenced the line of code which opens the recordset and said that it expected more parameters.

I still don't get what this means and am baffled as to how the script worked on my server and not the host's.

I'm not sure why your code is not working on your server if it's working at home. Are you working on different databases between the two (access 97 & 2000, access & SQL Server)?

The error is in the SQL Statement. I would suggest doing a response.write of the sql statement right before the execution and try to determine what it's trying to execute. The days field might be blank or non-numeric, etc.

tried that just now

I tried your suggestion.
That line came out like this

Code:

WHERE (((shipments.date_entered)>=Now()-1))
ORDER BY shipments.shipment_id, issue_details.price DESC;

I pasted the whole thing from the browser back into access and it worked fine. Its the identical file as I have on the remote server. The only difference is something on that server that doesn't want to let that sql execute on my access file.

Re: tried that just now

Originally posted by akohl I tried your suggestion.
That line came out like this

Code:

WHERE (((shipments.date_entered)>=Now()-1))
ORDER BY shipments.shipment_id, issue_details.price DESC;

I pasted the whole thing from the browser back into access and it worked fine. Its the identical file as I have on the remote server. The only difference is something on that server that doesn't want to let that sql execute on my access file.

I tried it like this.
I removed the single quotes around the date expression to get it to work in access. But I had the exact same results. The same error message even when the sql from the response.write(sqlStr) worked fine in access as a paste in. This is really starting to baffle me. do you think somethng is wrong with the server? Should I bug the hosting company about it and assert that the problem is with their ado and not with my script?