View Full Version : No value given for one or more required parameters Error message
bigjay
09-28-2008, 03:33 PM
Ok, I am at a total loss right now. I am doing a web based database program in ASP that I have done lots in the past and I am using the same code. Here is teh code that I am using:
Set db = Server.CreateObject("ADODB.Connection")
db.open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=D:\squirrel\database.mdb"
ShortName = Request.Cookies("cookie")("shortname")
strAllisons = "SELECT * FROM table WHERE ShortName=" & ShortName & " AND completed = 0;"
Set rstAllisons = server.CreateObject("ADODB.Recordset")
rstAllisons.open strAllisons, db, 1, 2, 1
The error is coming up on the rstAllisons.open line. Any ideas? I can't seem to get past it no matter what I do.
brazenskies
09-28-2008, 05:49 PM
print out the SQL string and see how it looks. If thats fine try just opening the recordset without any other parameters and see what happens...
rstAllisons.open strAllisons, db
bigjay
09-28-2008, 11:20 PM
Ok, when I print out the string value, I get this:
strAllisons = SELECT * FROM Allisions WHERE ShortName=bigjay AND Completed=0;
Couple of other things I did:
I made the open call as you indicated and got this message:
Microsoft JET Database Engine error '80040e10'
No value given for one or more required parameters.
/squirrel/index.asp, line 256
This is making no sense to me as I have used code like this before many times and have had no problems at all.
bigjay
09-28-2008, 11:51 PM
Ok, I just tried something. The database that I was using was built upon an import of Excel data into Access. I created a new dummy database, a single table and only a single record in it. That allowed me to get past the initial error that I reported up above in my fist post so it looks to a problem with the data that was in the database but I am getting a new error now that, again, doesn't make any sense.
After I open the database, I do a call to it to make sure I am not at the end of the file. The line looks like this:
Do While Not strAllisons.EOF
When I get to this line, I get this error message back from it:
Microsoft VBScript runtime error '800a01a8'
Object required: 'SELECT * FROM test;'
/squirrel/index.asp, line 270
The other interesting part of this is that the table was originally named testtbl and the error I got was this:
Microsoft VBScript runtime error '800a01a8'
Object required: 'SELECT * FROM testtb'
/squirrel/index.asp, line 270
Not sure why, but the last character was cut off on the error display back but the code shows it being testtbl and the string call looks like this when I print it out using a response.write:
SELECT * FROM testtbl;
I am dumbfounded right now.
bigjay
09-29-2008, 01:44 AM
Ok, sorry about the number of posts but I need to figure this out sooner than later.
I think it might be easier to lay this out as to what I have done and what I have going on with this site.
The site has two databases on it now, database 1 which as been there for a few years and functioning within asp scripts pulling data from it to display back to the end user. Data base is called simply with an include statement identifying the database and opening it and then a datafunctions include to sort through the data. Not entirely sure what the datafunction include does off hand but it looks like it helps sort through the code and manage it.
Database 2 is the one I am trying to add to the site. I am using the standard open/call statements through ASP to do this and I come across 2 separate errors. The first is I always die at the opening of the table. The database gets opened and the sql statement goes through without error and looks correct.
Error 2 is if I put in a very simplistic database with a single table and only two columns and a single entry in that table. If I use that code, I get past the table opening but always die at the check for the End of File and it always cuts the last few characters of the sql statement off for some reason.
Now, what I have done is mix and match my code all over to see if slight changes affect it. I have also gone through the database to make sure there is no bad data or spaces or wierd stuff and it all looks good.
I also just tried a new process. I copied a current ASP page from the site and renamed it and ran it. This page runs Database 1 that has been there for years and when I copy it into my new directory for this new database, it works just fine. I then changed the values to point to my new database and the associate table of the new database and obviously the table column ID's and then run it. I keep all code the same as before and it still dies at the opening of the table.
I have to assume that there is some security issue or something going on but I can't seem to find it. I have checked all shares and security and everything matches across the board. I need some more ideas on what to look for.
Thanks.
bigjay
09-29-2008, 02:33 AM
Ok, I did some more tinkering with it and found some more. I removed the WHERE part of the sql query statement and left it as SELECT * FROM allisions and it got past it so there is something in the WHERE part that is messing it up but I got to where I was checking for the EOF of the data and it still strips off part of the SQL statement at the end.
Does anyone know of any reason why this would do that?
Thanks.
brazenskies
09-29-2008, 09:36 AM
try replacing this into your original code...
strAllisons = "SELECT * FROM table WHERE ShortName='" & ShortName & "' AND completed = 0;"
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.