以下的function中如何将dao.Recordset 转换到adodb.Recordset上来:Public Function DaoSeek2Exactly(ByRef TBOBJ As dao.Recordset, keyfield1, keyfield2, Key1, Key2)
Dim ok, Tempkey, temp
If TBOBJ.EOF And TBOBJ.BOF Then
ok = False
Else
ok = False
TBOBJ.Seek ">=", Key1, Key2
If Not TBOBJ.NoMatch Then
Tempkey = UCase(Key1)
temp = TBOBJ.Book
Do While Tempkey = UCase(TBOBJ(keyfield1)) And UCase(Key2) = UCase(TBOBJ(keyfield2))
If TBOBJ(keyfield2) = Key2 Then
SeekExactly = True
ok = True
Exit Do
End If
TBOBJ.MoveNext
If TBOBJ.EOF Then Exit Do
Loop
'If Not ok Then
'TBOBJ.Book = temp
'ok = True
'End If
End If
End If
DaoSeek2Exactly = okEnd Function
Dim ok, Tempkey, temp
If TBOBJ.EOF And TBOBJ.BOF Then
ok = False
Else
ok = False
TBOBJ.Seek ">=", Key1, Key2
If Not TBOBJ.NoMatch Then
Tempkey = UCase(Key1)
temp = TBOBJ.Book
Do While Tempkey = UCase(TBOBJ(keyfield1)) And UCase(Key2) = UCase(TBOBJ(keyfield2))
If TBOBJ(keyfield2) = Key2 Then
SeekExactly = True
ok = True
Exit Do
End If
TBOBJ.MoveNext
If TBOBJ.EOF Then Exit Do
Loop
'If Not ok Then
'TBOBJ.Book = temp
'ok = True
'End If
End If
End If
DaoSeek2Exactly = okEnd Function
Function adoSeek2Exactly(ByRef TBOBJ As ADODB.Recordset, keyfield1, keyfield2, Key1, Key2) As Boolean
If TBOBJ.EOF And TBOBJ.BOF Then
ok = False
Else
ok = False
TBOBJ.Seek ">=", Key1, Key2
If Not TBOBJ.NoMatch Then '好象没有这个方法,dao不熟这是什么意思
Tempkey = UCase(Key1)
temp = TBOBJ.Book
Do While Tempkey = UCase(TBOBJ(keyfield1)) And UCase(Key2) = UCase(TBOBJ(keyfield2))
If TBOBJ(keyfield2) = Key2 Then
SeekExactly = True
ok = True
Exit Do
End If
TBOBJ.MoveNext
If TBOBJ.EOF Then Exit Do
Loop
'If Not ok Then
'TBOBJ.Book = temp
'ok = True
'End If
End If
End If
DaoSeek2Exactly = okEnd Function
.nomatch都行不通