| Answer: |
A typical example code might be:
' after creating and opening a connection... Set RS = Server.CreateObject("ADODB.RecordSet") RS.Open "someTableName", theConnection, adOpenForwardOnly, asLockOptimistic, adCmdTable
|
and the resulting error would be:
ADODB.Recordset error '800a0bb9' The application is using arguments that are of the wrong type, are out of acceptable range, or are in conflict with one another.
|
The problem: You have not defined the constants adOpenForwardOnly, asLockOptimistic, and adCmdTable. And VBScript converts any undefined variables into *zero*. So you *really* just did:
RS.Open "someTableName", theConnection, 0, 0, 0
|
And that is simply not legal, as VBS so carefully and succinctly tells you.
You need to include the file adovbs.inc in your page. For more on this topic, see ASPFAQ number 123.
Akhilesh correctly points out that you can also get this error if you try to use an uninitialized variable for the connection argument to ADODB.RecordSet.Open. This simple page illustrates that:
<HTML><BODY> <% Set conn = Server.CreateObject("ADODB.Connection") Set RS = Server.CreateObject("ADODB.RecordSet") conn.Open "someDSNperhaps" RS.Open "Select * From test", con ' ### misspelled variable name! ### %> </BODY></HTML>
|
This is a good argument for using <% OPTION EXPLICIT %> at the top of your ASP pages, as ASP would then tell you that con is not defined.
|