Microsoft KB Archive/258676

= PRB: Inconsistent Behavior Using rdoParameter's Value Property =

Article ID: 258676

Article Last Modified on 4/18/2000

-

APPLIES TO


 * Microsoft Visual Basic 5.0 Enterprise Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition

-



This article was previously published under Q258676



SYMPTOMS
When you upgrade from Visual Basic 5.0 to Visual Basic 6.0 and use an RDO Query with a parameter, a behavioral change may cause the following error:

S1090: [Microsoft][ODBC Microsoft Access Driver]Invalid string or buffer length



WORKAROUND
The workaround for this change in behavior is to ensure that rdoParameters are initialized with an empty string or NULL value prior to executing the rdoQuery.



MORE INFORMATION
When using the MSRDO20.dll version 5.01.4319 with Microsoft Access ODBC Driver version 4.00.4202.00, it was not necessary to initialize any parameters when using an RDO Query. The parameters would use a default value and successfully return the first record.

When upgrading to MSRDO20.DLL version 6.00.8450, it became necessary to explicitly initialize the parameters or else the above error message would be generated.

Steps to Reproduce Behavior
On a computer that has Visual Basic 6.0 installed, MSRDO20.DLL version 6.00.8450 and Microsoft Access Driver version 4.00.4202.00 (MDAC 2.1SP2), do as follows:  Create a new Standard Exe project. Form1 is created by default. Set a reference to the Microsoft Remote Data Objects 2.0.  Copy the code into the code module for Form1: Option Explicit

Private Sub Form_Load Dim cn As rdoConnection, qry1 As rdoQuery, rs As rdoResultset Dim sResults As String, i As Integer

Set cn = New rdoConnection With cn     .Connect = "DSN=biblio;" .EstablishConnection rdDriverCompleteRequired End With Set qry1 = cn.CreateQuery("QUERY1", "Select * from PUBLISHERS where Name like ? or City like '%'") 'qry1(0) = "" Set rs = qry1.OpenResultset For i = 0 To 3 sResults = sResults & ", " & rs(i).Name & ":" & rs(i) Next debug.print "First Record: " & Mid(sResults, 3) End Sub  Create a DSN named Biblio and point it to the Microsoft Access Biblio sample database. Press the F5 key to run the code. You should see the following error:

S1090: [Microsoft][ODBC Microsoft Access Driver]Invalid string or buffer length

  Uncomment the following line of code: 'qry1(0) = "" </li> Press F5, and check the debug window to see that the message, "First Record: PubID:1, Name:SAMS" was returned successfully.</li></ol>

Keywords: kbrdo kbdatabase kbprb KB258676

-

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

© Microsoft Corporation. All rights reserved.