How do I rectify the following DB Tester Error "(07002) [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 2"?
When using the DB_ExecuteSql (),
">hstmnt=DB_ExecuteSql(hdbc, "SELECT FirstName, LastName FROM MailingList, Organizeation WHERE Organization.OrganizationID=MailList.OrganizationID" )
The following error is thrown:
">[-] Testcase DB_try - 1 error [ ] *** Error: (07002) [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 2. [ ] Occurred in DB_ExecuteSql [ ] Called from DB_try at database_try.t(15)
The first thing to check is that you actually are passing in the correct amount of parameters and that you are choosing the right names for your tables, columns etc....
This error is generally thrown due to typing or spelling errors. You can usually tell how many mistakes there are due to the number at the end of the error message. In the above case, there were two spelling mistakes. Because it wasn"t recognizing 2 of the parameters it throws back the error that it was getting 2 less parameters than it was expecting.
In the above example, the two errors where:
One instance of Organizeation was spelled incorrectly, should have been Organization.
One instance of the table MailingList was incorrectly referred to as MailList.