PRB: ????? ????? ??? ??? ADODB Recordset ????? ????? ????? Excel XLS

?????? ????????? ?????? ?????????
???? ???????: 246167 - ??? ???????? ???? ????? ????? ??? ???????.
????? ???? | ?? ????

?? ??? ??????

???????

??? Microsoft ???? ?????? Excel ?? ???? Visual Basic ?? Visual Studio 6.0 ?????? ????? ?????? Service Pack 3 (?? ????) ????????? ????? ???? (IDE) ?? ?????? ????? ODBC Excel ISAM ?????? ??? ??? ??????? ???????:
????? ??? ???-2147467259 (80004005): ????? ??????? ??? ????? ?? ??? ???? ??????? ?????? [Microsoft] [?????? ????? Excel ODBC]
???? ??? ??????? ?? ?? ??? ??? ????? ????????? ???????? ???? IDE Visual Basic.

?????? ?? ???? ??? ????? ??? ?? ????? ???? ?????? ?? ????? SQL ??? ???? ??????:
SELECT * FROM ...
				
????? ? ?? ???? ??? ??????? ???? EXE ??????.

?????

??? ????? ???? IDE Visual Basic ????? ?? ???? ???? 3.

??????? ????

????? ????? ????? ??????

  1. ????? ???? ?????? ?? Microsoft Excel 97 ?? ?? Microsoft Excel 2000 ?? ?? ????? ??????? ?? ???? prescribe:
    • ?1 = f1
    • ?1 = f2
    • c? = f3

  2. ??? ???? ???????? ??? ?????? DSN ??????? ?????.
  3. ??? ????? Visual Basic 6.0 ?? Visual Studio 6.0 ?????? ????? ?????? Service Pack 3 ?? ??????? ??????.
  4. ????? EXE ????? ???? ?? ?? ?????? ???? ??? "?????? ?????? Microsoft Active Directory". ?? ???? ???????? ???????? ??????? ?? ???????:
    Public Sub Form_Load()
    
        Dim constring As String
        Dim Connection As New ADODB.Connection
        Dim cmd As New ADODB.Command
        Dim rs As New ADODB.Recordset
    
    '   define a DSN IMPORT-XLS, using the Excel ODBC driver, and point it to the xls file
         constring = "Provider=MSDASQL;DSN=IMPORT-XLS"
         
         Connection.Open constring
         Set cmd.ActiveConnection = Connection
         cmd.CommandType = adCmdText
         
    '   The following .CommandText causes the error, but only the first time it is run within the ide.
       cmd.CommandText = "Select F1, F2 from ""Sheet1$"""
    '   The following .CommandText will not cause the error.
    '    cmd.CommandText = "Select * from ""Sheet1$"""
    
         rs.CursorLocation = adUseClient
         rs.CursorType = adOpenStatic
         rs.LockType = adLockReadOnly
         rs.Open cmd
         While Not rs.EOF
            MsgBox rs.Fields(0)
            rs.MoveNext
         Wend
    
    End Sub
    					
  5. ????? ????????? ???????? ?????_???????.
  6. ????? ???????.
  7. ?? ????? ?????? ???? ??? ????? ??????? ???? ?????; ?? ???? ?? ????? ???????.

???????

???? ???????: 246167 - ????? ??? ??????: 06/????? ??????/1425 - ??????: 3.1
????? ???
  • Microsoft Visual Basic 6.0 Learning Edition
  • Microsoft Visual Basic 6.0 Professional Edition
  • Microsoft Visual Basic Enterprise Edition for Windows 6.0
  • Microsoft Visual Basic 6.0 Enterprise Edition Service Pack 3
  • Microsoft Visual Basic 6.0 Enterprise Edition Service Pack 4
  • Microsoft Visual Basic 6.0 Enterprise Edition Service Pack 5
  • Microsoft ActiveX Data Objects 2.1 Service Pack 2
  • Microsoft ActiveX Data Objects 2.5
  • Microsoft ActiveX Data Objects 2.6
  • Microsoft ActiveX Data Objects 2.7
????? ??????: 
kbmt kbdatabase kbiisam kbprb KB246167 KbMtar
????? ????
???: ??? ????? ??? ?????? ???????? ?????? ????? ???? ????? ?????????? ????? ?? ????????? ?????? ????. ???? ???? ?????????? ???? ?? ???????? ???????? ?????? ????????? ????? ????????? ???????? ????? ???????? ?????? ?? ?????? ??? ?? ???????? ???????? ?? ????? ??????? ?????? ??? ??????? ?????? ??. ?????? ?? ???? ??? ??????? ???????? ????? ?? ???? ????? ?????? ??? ????? ??? ????? ??????? ?? ????? ?? ?????? ??? ??? ??????? ??????? ?? ????? ????? ????? ????? ?????. ?? ????? ???? ?????????? ??????? ??? ????? ?? ??????? ?? ????? ?????? ?? ??? ????? ?? ????? ??????? ?? ???????? ?? ??? ???????. ???? ???? ?????????? ???????? ??? ????? ?????? ??????? ??????
???? ??? ????? ??????? ?????? ??????????246167

????? ???????

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com