本帖最后由 病毒专收员 于 2012-5-19 16:22 编辑 Func _accessQuery_Like($adSource, $adTable, $adCol1,$Find1, $adCol2,$Find2, $adFull = 1)
Local $I, $Rtn
Local $oADO = 'ADODB.Connection'
If IsObj($oADO) Then
$oADO = ObjGet('', $oADO)
Else
$oADO = _dbOpen($adSource)
EndIf
If IsObj($oADO) = 0 Then Return SetError(1)
Local $oRec = _dbOpenRecordset();ObjCreate("ADODB.Recordset")
If IsObj($oRec) = 0 Then Return SetError(2)
$oRec.Open("SELECT * FROM " &$adTable & " WHERE " & $adCol1 & " = '" & $Find1 & "'" & " AND " & $adCol2 & " = '" & $Find2 & "'", $oADO, $adOpenStatic, $adLockOptimistic)
If $oRec.RecordCount < 1 Then
Return SetError(1)
Else
SetError(0)
$oRec.MoveFirst()
;;MsgBox(0,'TEST', "Number of records: " & $oRec.RecordCount);;<<====== For testing only
Do
If $adFull = 1 Then
For $I = 0 To _accessCountFields($adSource, $adTable) - 1
;;MsgBox(0,'TEST 2 ', "Value of field " & $oRec.Fields($I).Name & ' is:' & @CRLF & @CRLF & $oRec.Fields($I).Value);;<<====== For testing only
$Rtn = $Rtn & $oRec.Fields($I).Value & Chr(28);;<<====== Separate the fields with a non-printable character
Next
EndIf
$Rtn = $Rtn & Chr(29);;<<====== Separate the records with a non-printable character
$oRec.MoveNext()
Until $oRec.EOF
$oRec.Close
$oADO.Close
If $adFull = 1 Then Return StringSplit(StringTrimRight($Rtn, 2), Chr(29))
Return StringSplit(StringTrimRight($Rtn, 1), Chr(29))
EndIf
EndFunc ;==>_accessQueryLike
自己解决了! |