PRB: ?????? ?????? ??? 3001 ?? ?????? ????? ???????

?????? ????????? ?????? ?????????
???? ???????: 216873 - ??? ???????? ???? ????? ????? ??? ???????.
????? ???? | ?? ????

???????

?????? ????? ?? ????? ???????? ?? ??????? ????? ADO (??? ???? ??????: ??????? ?????? ????? ?? ???????? ?? ???????: "FieldName FieldName ???? ???????") ?????? ????? ??????:
??? ??? ??????? '3001':
?????? ??????? ????? ?? ????? ??? ???? ?? ???? ?????? ??????? ?? ??????? ?? ????? ?????.

?????

?? ???? ????? ??? ??????? ?? ????????? ??????? ?? ADO. ??? ????? ???? ???? ?????? ??????? ????? ADO ??? ???:
"FieldName ???? ??????? 'Literal_Value'"
?? ???? ??? ?????? 'Literal_Value' ????? ?? ??? ?? ?????. ?? ????? ??????? ??????? ?????? ???????? ??? ???????. ?????? ?????? ???? ?????? ??? 3001.

????

???? ???? ?? ???? ???? ??? ??????? ??? ?????? ??????? ???????? ?? ?????? ???? ???????. ????? ??? ??????? ??? ??? ???? ??? ?????? ??????? ??? ??????. ???? ??????? ???? ?? ???? ?????? ?? ???? ????? ???????? ???? ??? ??????? ????????. ??? ???? ??????:
rs.Filter = "Field1 Operator1 'Value1' AND Field2 Operator2 'Value2'"
				

??? ?? ?????? ???? ????? Field1 ? Field2, ?????? ??? ??????? ????? ????? ???? (??? ????? ??????) ?? ????? ???? (??? ?????? ??????) ?????? ??????? ???? ????. ????? ??????? ???? ???? ???? ?????? ??? ????? ????? ???? (?? ??????? ??????) ?????? ??????? ?????? ???????? ?????? ??????? ????????.

???? ??? ??????? ????? ?????? ?????? ?? ??? "??????? ??????" ?? ??? ??????? ??.

?????: ???? ??????? ?? ?????? "??????? ??????" ??? ??? ????? ???? ??????? ??? ?? ???? ??????? ?? ?? ????? ? ??? ?? ??? ?? ????? ? ?????? ???????? ??????? ?/?? ???????? ???? ????.

?????

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

??????? ????

??? ????? ??????? ADO ??????? ????? ?????? ????? ?????--??? ???????:

????? ???????? ????? ?? ?????? ?? ????? FieldName - ???? - ?????? (??? ???? ??????? "??? ??????? = 'Smith'"). ????? ????? ?????? ????? ?????? ??? ?????? ??????? ?? AND (??? ???? ??????? "??? ??????? = 'Smith' AND ????? ????? = 'John'") ?? OR (??? ???? ??????? "??? ??????? = 'Smith' ?? ??? ??????? = 'Jones'").

??? ????? ???? ????????? ??????? ?????? "????? ????????":

?????? ?? ?????? ???? ???? ?????? ??? ????? (??? ???? ??????? '?????' # 8 / # 24/95 12.345 ?? $ 50.00). ??????? ?????? ???????? ??????? ?? ??????? ?? ????? ?????? (#) ?? ????????. ?????, ????? ??????? ?????? ??????? ? ??????? ??????. ??? ??? ???? ??????? ??? ???? ???? ??????? ???? ?????. ??? ??????? ??????? (*) ?????? ??????? (%) ????? ????? ?????? ??? ? ??? ?? ???? ????? ?????? ?? ???????. ?? ???? ?? ???? ???? ?????.
????? ????? ????? ??????
===========================

  1. ??? ???? ??????? Microsoft Visual Basic. ??? ????? Form1 ???? ???????.
  2. ????? ???? Project ??? ????? 2.x ?????? ?????? ActiveX Microsoft.
  3. ????? ?? ??? ?? ???????. ??? ????? Command1 ???? ???????.
  4. ???? ???????? ???????? ??????? ?? ?????? "????? ???" Form1:
   Option Explicit
   Dim cn As New ADODB.Connection
   Dim rs As New ADODB.Recordset

   Private Sub Command1_Click()
       cn.Open "provider=SQLOLEDB;Data Source=<your data source>;User ID=<uid>;" _ 
    "password=;Initial Catalog=pubs;"
       On Error Resume Next
       cn.Execute "drop table tblFilterTest"
       On Error GoTo errh
       ' Create the test table
       cn.Execute "create table tblFilterTest(ID int primary key, Field1  
    varchar(20), Field2 varchar(20))"
       ' Open ADO recordset
       rs.Open "select * from tblFilterTest", cn, adOpenKeyset, 
    adLockOptimistic
       ' Add first record
       rs.AddNew
       rs("ID") = 1
       rs("Field1") = "A"
       rs("Field2") = "B"
       rs.Update
       rs.Requery
   
       ' Add 2nd record
       rs.AddNew
       rs("ID") = 2
       rs("Field1") = "D"
       rs("Field2") = "C"
       rs.Update
       rs.Requery
    
       ' Print original recordset
       Debug.Print "Original Recordset:"
       Debug.Print "====================="

       While Not rs.EOF
            Debug.Print rs("Field1") & vbTab & rs("Field2") 
             rs.MoveNext
       Wend

       rs.MoveFirst

       ' You get error 3001 on the following line
       rs.Filter = " Field1 > Field2 "

       ' To demonstrate the workaround, comment the preceding line and
       ' uncomment the following line:

       ' Call Filter
       Exit Sub

   errh:
       Debug.Print "Error Number:", Err.Number
       Debug.Print "Error Source:", Err.Source
       Debug.Print "Error Description:", Err.Description
   End Sub

   Private Sub Filter()
       Debug.Print "Filtered Recordset: "
       Debug.Print "====================="
    
       While Not rs.EOF
         If rs("Field1") > rs("Field2") Then
             Debug.Print rs("Field1") & vbTab & rs("Field2") 
         End If
         rs.MoveNext
       Wend
   End Sub
				
???? F5 ?????? ???????, ????? ????? 3001 ????.

?????

????? ?? ?????????? ?????? ?????? ????? ??????? ADO.
?????? ??? ???? ?? ?????????? ?????? ?????? ??????? ??????? ?? "????? ??????? ?? Microsoft:
195222PRB: ??? ADO ????? ?????? ????? ???? ???

???????

???? ???????: 216873 - ????? ??? ??????: 05/????? ???????/1422 - ??????: 1.0
????? ???
  • Microsoft ActiveX Data Objects 2.0
  • Microsoft ActiveX Data Objects 2.01
  • Microsoft ActiveX Data Objects 2.1
  • 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 kbcode kbdatabase kbfix kbprb KB216873 KbMtar
????? ????
???: ??? ????? ??? ?????? ???????? ?????? ????? ???? ????? ?????????? ????? ?? ????????? ?????? ????. ???? ???? ?????????? ???? ?? ???????? ???????? ?????? ????????? ????? ????????? ???????? ????? ???????? ?????? ?? ?????? ??? ?? ???????? ???????? ?? ????? ??????? ?????? ??? ??????? ?????? ??. ?????? ?? ???? ??? ??????? ???????? ????? ?? ???? ????? ?????? ??? ????? ??? ????? ??????? ?? ????? ?? ?????? ??? ??? ??????? ??????? ?? ????? ????? ????? ????? ?????. ?? ????? ???? ?????????? ??????? ??? ????? ?? ??????? ?? ????? ?????? ?? ??? ????? ?? ????? ??????? ?? ???????? ?? ??? ???????. ???? ???? ?????????? ???????? ??? ????? ?????? ??????? ??????
???? ??? ????? ??????? ?????? ??????????216873
????? ??????? ?? ????? ???? ?? ????? ???????
?? ????? ????? ?????? ???? ???? ???? ??? ??????? ??? ?? ? ?? ??? ??????? 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