Microsoft KB Archive/249638: Difference between revisions

From BetaArchive Wiki
m (Text replacement - "&" to "&")
m (Text replacement - """ to """)
 
Line 45: Line 45:
== SYMPTOMS ==
== SYMPTOMS ==


If you submit a LEFT OUTER JOIN query to the Microsoft Access ODBC driver and a Boolean ("Yes/No") column is one of the columns in the fields list, the following error message occurs when you reference the resulting Microsoft ActiveX Data Objects (ADO) recordset:
If you submit a LEFT OUTER JOIN query to the Microsoft Access ODBC driver and a Boolean ("Yes/No") column is one of the columns in the fields list, the following error message occurs when you reference the resulting Microsoft ActiveX Data Objects (ADO) recordset:
<div class="errormessage">
<div class="errormessage">


Line 91: Line 91:
      
      
     On Error Resume Next
     On Error Resume Next
     Kill &quot;x.mdb&quot;
     Kill "x.mdb"
     On Error GoTo 0
     On Error GoTo 0
      
      
     cat.Create &quot;Provider=Microsoft.jet.oledb.4.0;data source=x.mdb;&quot;
     cat.Create "Provider=Microsoft.jet.oledb.4.0;data source=x.mdb;"
      
      
     tbl.Columns.Append &quot;cChar&quot;, adVarWChar, 5
     tbl.Columns.Append "cChar", adVarWChar, 5
     tbl.Columns.Append &quot;cBool&quot;, adBoolean
     tbl.Columns.Append "cBool", adBoolean
     tbl.Name = &quot;tOne&quot;
     tbl.Name = "tOne"
     tbl.Keys.Append &quot;PK1&quot;, adKeyPrimary, &quot;cChar&quot;
     tbl.Keys.Append "PK1", adKeyPrimary, "cChar"
     cat.Tables.Append tbl
     cat.Tables.Append tbl
     Set tbl = Nothing
     Set tbl = Nothing
      
      
     tbl.Columns.Append &quot;cChar2&quot;, adVarWChar, 5
     tbl.Columns.Append "cChar2", adVarWChar, 5
     tbl.Columns.Append &quot;cChar3&quot;, adVarWChar, 5
     tbl.Columns.Append "cChar3", adVarWChar, 5
     tbl.Name = &quot;tTwo&quot;
     tbl.Name = "tTwo"
     tbl.Keys.Append &quot;PK2&quot;, adKeyPrimary, &quot;cChar2&quot;
     tbl.Keys.Append "PK2", adKeyPrimary, "cChar2"
     cat.Tables.Append tbl
     cat.Tables.Append tbl
     Set tbl = Nothing
     Set tbl = Nothing
Line 116: Line 116:
     cn.CursorLocation = adUseClient
     cn.CursorLocation = adUseClient


     cn.Open &quot;Provider=MSDASQL.1;Driver={Microsoft Access Driver    (*.mdb)};DBQ=x.mdb;&quot; 'Errors
     cn.Open "Provider=MSDASQL.1;Driver={Microsoft Access Driver    (*.mdb)};DBQ=x.mdb;" 'Errors
     'cn.Open &quot;provider=Microsoft.jet.oledb.4.0;data source=x.mdb&quot; 'Works
     'cn.Open "provider=Microsoft.jet.oledb.4.0;data source=x.mdb" 'Works
      
      
     cn.Execute &quot;INSERT INTO tOne VALUES ('aaaaa',0)&quot;
     cn.Execute "INSERT INTO tOne VALUES ('aaaaa',0)"
     cn.Execute &quot;INSERT INTO tOne VALUES ('bbbbb',1)&quot;
     cn.Execute "INSERT INTO tOne VALUES ('bbbbb',1)"
     cn.Execute &quot;INSERT INTO tOne VALUES ('ccccc',0)&quot;
     cn.Execute "INSERT INTO tOne VALUES ('ccccc',0)"
     cn.Execute &quot;INSERT INTO tTwo VALUES ('aaaaa',1)&quot;
     cn.Execute "INSERT INTO tTwo VALUES ('aaaaa',1)"
     cn.Execute &quot;INSERT INTO tTwo VALUES ('ddddd',1)&quot;
     cn.Execute "INSERT INTO tTwo VALUES ('ddddd',1)"
     cn.Execute &quot;INSERT INTO tTwo VALUES ('eeeee',1)&quot;
     cn.Execute "INSERT INTO tTwo VALUES ('eeeee',1)"
      
      
     strSQL = &quot;SELECT cChar2, cChar3, cChar, cBool &quot; & _
     strSQL = "SELECT cChar2, cChar3, cChar, cBool " & _
             &quot;FROM tOne LEFT OUTER JOIN tTwo ON tOne.cChar = tTwo.cChar2&quot;
             "FROM tOne LEFT OUTER JOIN tTwo ON tOne.cChar = tTwo.cChar2"


     rs.Open strSQL, cn, adOpenStatic, adLockOptimistic, adCmdText
     rs.Open strSQL, cn, adOpenStatic, adLockOptimistic, adCmdText
     MsgBox rs.RecordCount 'Errors here!
     MsgBox rs.RecordCount 'Errors here!
                     </pre></li>
                     </pre></li>
<li>Press F5 to run the project.'''RESULT''': The error message described in the &quot;Symptoms&quot; section occurs.</li></ol>
<li>Press F5 to run the project.'''RESULT''': The error message described in the "Symptoms" section occurs.</li></ol>





Latest revision as of 13:51, 21 July 2020

Knowledge Base


Article ID: 249638

Article Last Modified on 10/17/2003



APPLIES TO

  • Microsoft Data Access Components 2.5
  • Microsoft Open Database Connectivity Driver for Access 4.0



This article was previously published under Q249638

SYMPTOMS

If you submit a LEFT OUTER JOIN query to the Microsoft Access ODBC driver and a Boolean ("Yes/No") column is one of the columns in the fields list, the following error message occurs when you reference the resulting Microsoft ActiveX Data Objects (ADO) recordset:

Run-time error '-2147467259 (80004005)': Data provider or other service returned an E_FAIL status.

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.

This problem was corrected in MDAC version 2.6.


MORE INFORMATION

Steps to Reproduce Behavior

  1. Start Microsoft Visual Basic 6.0 and choose a Standard EXE project.
  2. Add the following Project references:
    • Microsoft ActiveX Data Objects 2.5 Library

      -and-

    • Microsoft ADO Ext. 2.5 for DDL and Security



  3. Paste the following code into the Load event of the default form:

        Dim strSQL As String
        Dim cat As New ADOX.Catalog
        Dim tbl As New ADOX.Table
        Dim cn As New ADODB.Connection
        Dim rs As New ADODB.Recordset
        
        On Error Resume Next
        Kill "x.mdb"
        On Error GoTo 0
        
        cat.Create "Provider=Microsoft.jet.oledb.4.0;data source=x.mdb;"
        
        tbl.Columns.Append "cChar", adVarWChar, 5
        tbl.Columns.Append "cBool", adBoolean
        tbl.Name = "tOne"
        tbl.Keys.Append "PK1", adKeyPrimary, "cChar"
        cat.Tables.Append tbl
        Set tbl = Nothing
        
        tbl.Columns.Append "cChar2", adVarWChar, 5
        tbl.Columns.Append "cChar3", adVarWChar, 5
        tbl.Name = "tTwo"
        tbl.Keys.Append "PK2", adKeyPrimary, "cChar2"
        cat.Tables.Append tbl
        Set tbl = Nothing
        
        Set cat = Nothing
        
        Set cn = New ADODB.Connection
        Set rs = New ADODB.Recordset
        cn.CursorLocation = adUseClient
    
        cn.Open "Provider=MSDASQL.1;Driver={Microsoft Access Driver     (*.mdb)};DBQ=x.mdb;" 'Errors
        'cn.Open "provider=Microsoft.jet.oledb.4.0;data source=x.mdb" 'Works
        
        cn.Execute "INSERT INTO tOne VALUES ('aaaaa',0)"
        cn.Execute "INSERT INTO tOne VALUES ('bbbbb',1)"
        cn.Execute "INSERT INTO tOne VALUES ('ccccc',0)"
        cn.Execute "INSERT INTO tTwo VALUES ('aaaaa',1)"
        cn.Execute "INSERT INTO tTwo VALUES ('ddddd',1)"
        cn.Execute "INSERT INTO tTwo VALUES ('eeeee',1)"
        
        strSQL = "SELECT cChar2, cChar3, cChar, cBool " & _
                 "FROM tOne LEFT OUTER JOIN tTwo ON tOne.cChar = tTwo.cChar2"
    
        rs.Open strSQL, cn, adOpenStatic, adLockOptimistic, adCmdText
        MsgBox rs.RecordCount 'Errors here!
                        
  4. Press F5 to run the project.RESULT: The error message described in the "Symptoms" section occurs.


Keywords: kbbug kbfix kbjet kbmdac260fix kbmdacnosweep KB249638