Microsoft KB Archive/194024

= PRB: Recordset DTC moveAbsolute Does Not Work With QueryString =

Article ID: 194024

Article Last Modified on 3/16/2005

-

APPLIES TO


 * Microsoft Visual InterDev 6.0 Standard Edition

-



This article was previously published under Q194024



SYMPTOMS
The Recordset DTC moveAbsolute method will not work when a query string variable is passed as the parameter (for example, rsDTC.moveAbsolute(4) vs rsDTC.moveAbsolute(number) where "number" is a Query String variable containing the number 4),



CAUSE
Query string varibles are by default a "string" datatype and the parameter passes to the moveAbsolute method must be an integer.



RESOLUTION
Convert the variable to an integer type and then pass it to the moveAbsolute method. In VBScript, you may use the cint function like this: number = cint(variable) Now you can pass "number" into the moveAbsolute method.

NOTE: This cannot be done in JScript or JavaScript because every variable is an Object in JScript and JavaScript does not have an applicable type for the moveAbsolute method.



STATUS
This behavior is by design.



Steps to Reproduce Behavior
 Create a new project in Visual InterDev 6.0. Make sure that the default script language is set to Server: VBScript and Client: JavaScript. Create a valid data connection for your project. Add a new Active Server Page (ASP) to the project. Drag a recordset DTC onto the ASP page between the <BODY></BODY> tags and enable the Scripting Object Model when asked.</li> Set the connection of your recordset DTC to be your valid connection and set the Database object to Table and choose a valid Object Name.</li> Drag a grid DTC onto your page below the recordset and bind it to your recordset. Also, choose a few fields to show in the grid.</li> Drag a text box DTC onto your page below the grid and bind it to a key or identity field from your recordset DTC.</li>  In the <HEAD></HEAD> tags of your page insert a server script block and paste the following code into the script block: Sub thisPage_Onshow absPos = Request.QueryString("number") If absPos <> "" then 'absPos = cint(Request.QueryString("number")) Recordset1.moveAbsolute(absPos) end if     End Sub NOTE: This code assumes that your recordset DTC is named Recordset1. </li> Save your page and view it in the browser, make sure you append the following query string value to the URL: ?number=4. NOTE: This assumes that you have four or more records in the table you queried.</li> You will notice that the text box will have a value corresponding to record 1, meaning that the moveAbsolute did not work.</li> Uncomment the commented line of code in the thisPage_Onshow sub, save your page, and view it again with the query string value of 4.</li></ol>

This time you will see that the text box contains data from the fourth record of the recordset.

Keywords: kbide kbprb kbctrl KB194024

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.