FIX: ADO ?????? ???????? ?? ??????? ????? ?? Excel

?????? ????????? ?????? ?????????
???? ???????: 314763 - ??? ???????? ???? ????? ????? ??? ???????.
????? ???? | ?? ????

?? ??? ??????

???????

??? ??????? ADO ?????? ???? ????? ?? ???????? ?? ???? ??? Microsoft Excel ??? ???????? ????? ?????? ????? ??? ??? ??????? ??????? ?? ADO ????? ??? ???????? ?? ?????? ??????? ??????? ?? ??????? ??? ???? ?? Excel.

???? ??? ??????? ?? ?? ???? Microsoft OLE DB ?? Jet ??????? 4.0 ? Microsoft ????? ODBC ?? Excel. ???? ??? ??????? ??? ?? ??? ??? ?????? ????? SQL INSERT ?? AddNew ?????? ????? ???? ADO Recordset.

?? ???? ??? ??????? ??? ??? ??????? ?? ????? Excel ???? Excel ??? ADO ????? ????? ?????.

??? ???? ??????? Microsoft ??????? ?????? ??? ???? ???? ???? ??????? ??? ??? Excel ??????? ????? ?????? ADO. ?????? ??? ??????? ??????? ???? ??? ??? ??????? ????? ?????? ?? "????? ??????? ?? Microsoft:
319998BUG: ???? ??????? ??? ????????? ??? ???? ??? Excel ???????? ADO
???? ??? "???? ?? ?????????" ?????? ??? ?????? ??? ??????? ???? ??? ???????.

????

??? ??? ???????? ??? ?????? ??? ???? ???? ???? ?? ???? ?????? Jet 4.0. ?????? ??? ??????? ??????? ???? ??? ??? ??????? ?????? ?????? ?? "????? ??????? ?? Microsoft:
239114?????: ?????? ??? ???? ???? ???? ?? ???? ????? ?????? Microsoft Jet 4.0

?????

???? Microsoft ?? ??? ??? ?? ?????? Microsoft ??????? ?? ????? ??? ???????.

??????? ????

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

  1. ??? Microsoft Excel ?? ?? ?????? ???? ????.
  2. ?? ??????1 ? ???? ???????? ????????? ??????? ????? ?? ?????? A1 ?? ??????? ??????? ??????:
    ?? ??? ??????????? ??? ??????
    ColumnAColumnBColumnCColumnDColumnEColumnF
    11??????11??????
    22??????22??????

  3. ???? ?????? Test.xls. ????? ??? ??????? Excel ?????? ???? ??? ????? ?????? ??????.
  4. ?? Microsoft Visual Basic? ????? ????? EXE ????? ????. ??? ????? Form1 ???? ???????.
  5. ?? ??????? ??????? ???? "?????". ??? ?? ??????? ???????? ????? ?????? ?????? ActiveX ?? Microsoft "??? 2. x ?????.
  6. ??? ???? ???? CommandButton ??? Form1 ?? ?? ???? ???????? ???????? ??????? ?? ????? ??? ????? ???. ???? ?? ??? ????????? ???????? ????? ????? ????? ?? ?????? ?????? ?????? C.
    Private Sub Command1_Click()
       Dim strCn As String
       Dim cn As ADODB.Connection
       Dim rs As ADODB.Recordset
       Dim fld As ADODB.Field
    
       'Open connection
       strCn = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
          "Data Source=" & App.Path & "\Test.xls;" & _
          "Extended Properties=Excel 8.0"
       Set cn = New ADODB.Connection
       cn.Open strCn
        
       'Add new values.
       Set rs = New ADODB.Recordset
       With rs
          .CursorLocation = adUseClient
          .Open "Select * from [Sheet1$]", cn, adOpenStatic, adLockOptimistic
          .AddNew
          .Fields("ColumnA").Value = 3
          .Fields("ColumnB").Value = 3
          .Fields("ColumnC").Value = ""
          .Fields("ColumnD").Value = 3
          .Fields("ColumnE").Value = 3
          .Fields("ColumnF").Value = "testing"
          .Update
          .Close
       End With
       Set rs = Nothing
       cn.Close
       Set cn = Nothing
    End Sub
    					
  7. ??? ????? ?????? Visual Basic ?? ??? ?????? Test.xls ??????.
  8. ????? ??????? ?? ???? ??? ????. ?? ????? ?????? ???? ???? ???? ?????? ??????? ?? Visual Basic Integrated ????? ???? (IDE) ? ?? ???? ????? ????? ???????:
    ??? ??? ???????-2147467259 (80004005): ???? ????? ??????? ??? ????? ?? ??? ???? ???????
    ??? ????? ??????.?????? ??? ??????? ??????? ???? ??? ??? ??????? ????? ?????? ?? "????? ??????? ?? Microsoft:
    246167????? ????? ??? ??? ADODB Recordset ????? ????? ????? Excel XLS
  9. ?? ???? ???? ????? ????? ???? ??? Debug ????? ??????? F5 ???????? ????? ???????. ???? ?? ???? ??? ??? ????? ???? ???? ?? ???????? ????? ?? ??? ???? ????? ????? ?????.
  10. ????? ??????? ??? ????? ???????. ????? ??? Test.xls ?? Excel ?? ?? ?????? ???????? ???????? ?? ??????1. ????? ??????? ???????:

    ?? ??? ??????????? ??? ??????
    ColumnAColumnBColumnCColumnDColumnEColumnF
    11??????11??????
    22??????22??????
    3333??????

    ??? ???? ???? ???????? ???????:

    ?? ??? ??????????? ??? ??????
    ColumnAColumnBColumnCColumnDColumnEColumnF
    11??????11??????
    22??????22??????
    3333??????

    ???? ??? ?? ?? ????? ??????? ??????? ???? ??? ??????? ?? ColumnC ? ?????. ?????? ????? ??? ??? ????? ??????? ??????? ???? ???? ??? ?????? ?????? ?????????. ?? ????? ???? ????? ???????.

??????? 1

????? ?????? ???????? ??? ???:

?? ??? ??????????? ??? ??????
ColumnAColumnBColumnCColumnDColumnE
1??????11??????
2??????22??????

?? ????? Visual Basic ????? ????? ?????? ????? ??????? ???????:
   'Add new values.
   Set rs = New ADODB.Recordset
   With rs
      .CursorLocation = adUseClient
      .Open "Select * from [Sheet1$]", cn, adOpenStatic, adLockOptimistic
      .AddNew
      .Fields("ColumnA").Value = 3
      .Fields("ColumnB").Value = ""
      .Fields("ColumnC").Value = 3
      .Fields("ColumnD").Value = 3
      .Fields("ColumnE").Value = "testing"
      .Update
      .Close
   End With
   Set rs = Nothing
   cn.Close
   Set cn = Nothing
				
??? ??? Test.xls ?? Excel ??????1 ???? ???????? ???????:

?? ??? ??????????? ??? ??????
ColumnAColumnBColumnCColumnDColumnE
1??????11??????
2??????22??????
333??????

???? ??? ?? ???? ??? ??????? ??? ???? ???? ???? ???? ?????? ????? ?????.

??????? 2

????? ?????? ???????? ??? ???:

?? ??? ??????????? ??? ??????
ColumnAColumnBColumnCColumnDColumnEColumnFColumnG
11????????????11??????
22????????????22??????

?? ????? Visual Basic ????? ????? ?????? ????? ??????? ???????:
   'Add new values.
   Set rs = New ADODB.Recordset
   With rs
      .CursorLocation = adUseClient
      .Open "Select * from [Sheet1$]", cn, adOpenStatic, adLockOptimistic
      .AddNew
      .Fields("ColumnA").Value = 3
      .Fields("ColumnB").Value = 3
      .Fields("ColumnC").Value = ""
      .Fields("ColumnD").Value = ""
      .Fields("ColumnE").Value = 3
      .Fields("ColumnF").Value = 3
      .Fields("ColumnG").Value = "testing"
      .Update
      .Close
   End With
   Set rs = Nothing
   cn.Close
   Set cn = Nothing
				
??? ??? Test.xls ?? Excel ??????1 ???? ???????? ???????:

?? ??? ??????????? ??? ??????
ColumnAColumnBColumnCColumnDColumnEColumnFColumnG
11????????????11??????
22????????????22??????
3333??????

??? ????? ADO ?????? ????? ????? ? ???? ??? ?? ??? ??? ????? ??????? ??????? ???? ?? ??????? ?? ColumnC ? ColumnD ? ?????. ?????? ????? ??? ??? ????? ??????? ??????? ?????? ??? ?????? ?????? ?????????. ?? ????? ???? ????? ???????.

?????

?????? ??? ??????? ??????? ???? ??? ???? ????????? ????????? ??????? ?? "????? ??????? ?? Microsoft:
294410ACC2002: ?????? ??????? ????????? ?? ???????? ?? ????? ?????? ??? ????? ????? ??? Excel
257819HOWTO: ??????? ADO ?? ?????? Excel ?? Visual Basic ?? VBA

???????

???? ???????: 314763 - ????? ??? ??????: 22/?????/1426 - ??????: 1.2
????? ???
  • Microsoft ActiveX Data Objects 2.1
  • Microsoft ActiveX Data Objects 2.5
  • Microsoft ActiveX Data Objects 2.6
  • Microsoft OLE DB Provider for Jet 4.0
????? ??????: 
kbmt kbhotfixserver kbqfe kbbug kbfix kbiisam kbjet kbqfe KB314763 KbMtar
????? ????
???: ??? ????? ??? ?????? ???????? ?????? ????? ???? ????? ?????????? ????? ?? ????????? ?????? ????. ???? ???? ?????????? ???? ?? ???????? ???????? ?????? ????????? ????? ????????? ???????? ????? ???????? ?????? ?? ?????? ??? ?? ???????? ???????? ?? ????? ??????? ?????? ??? ??????? ?????? ??. ?????? ?? ???? ??? ??????? ???????? ????? ?? ???? ????? ?????? ??? ????? ??? ????? ??????? ?? ????? ?? ?????? ??? ??? ??????? ??????? ?? ????? ????? ????? ????? ?????. ?? ????? ???? ?????????? ??????? ??? ????? ?? ??????? ?? ????? ?????? ?? ??? ????? ?? ????? ??????? ?? ???????? ?? ??? ???????. ???? ???? ?????????? ???????? ??? ????? ?????? ??????? ??????
???? ??? ????? ??????? ?????? ??????????314763
????? ??????? ?? ????? ???? ?? ????? ???????
?? ????? ????? ?????? ???? ???? ???? ??? ??????? ??? ?? ? ?? ??? ??????? Microsoft ??? ????? ??? ??????? ????? ?????? ?????

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

 

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