PRB: 'Invalid Use Of Default Parameter' Error in a Recordset DTCID: Q194800
|
You may use the Data Command Properties dialog box to set the parameters for a parameter query instead of writing the code to use the Data Environment Object directly. After setting the parameters in the Data Command Properties dialog box, you may drag the Data Command from Project Explorer Window and drop it onto your Active Server Page (ASP) to create a Recordset Design-Time Control (DTC). When viewing the page in a browser, you may see the following error:
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC SQL Server Driver]Invalid use of default parameter
/textbox_Local/_ScriptLibrary/Recordset.ASP, line 466
When you drag a Data Command from the Project Explorer window and drop it onto an ASP page to create a Recordset DTC, all the values you entered in the Command dialog box are carried over to the Recordset DTC except the Value field. Data Environment uses this value for design-time data binding, and run-time command object execution. When this field is not set during runtime, the above error is generated.
Open the Properties dialog box of the Recordset DTC, select Parameters tab,
and enter the values you want to use for the parameter. These values should
be the same as ones you entered in the Command dialog box.
The parameters can also be set using VBScript on an ASP page and within the
<BODY> tags of an ASP page prior to the Recordset DTC.
Set the parameters using the setParameter method of the Recordset DTC and
open the Recordset. Use this sample snippet when the Automatically open the
Recordset is cleared under the Implementation tab of the Recordset
Properties dialog box, for example:
<%
'Sets the first parameter
Recordset1.setParameter 0, Request.Form("value1")
'Sets the second parameter
Recordset1.setParameter 1, Request.Form("value2")
'Open recordset
Recordset1.open()
%>
This behavior is by design.
The values you enter must be the correct data type and size. The values
must be able to be evaluated at run time.
If you are using a variable, that variable's value must be set prior to
opening the Recordset DTC; alternately, you can use constants or Request
objects.
SELECT * FROM authors WHERE (au_id = ?) AND (au_lname = ?)
Keywords : kbVisID600 kbGrpASP
Version : WINDOWS:6.0
Platform : WINDOWS
Issue type : kbprb
Last Reviewed: May 5, 1999