RDO问题求教
问题描述:此函数用来查询仓单在MFG/PRO中的状态,若存在则不上传该FTN No资料,读取其备注信息(ftnlot_remarks_2),函数置假;否则则上传其资料,函数置真。
问题在于现在我在MFG/PRO中可查询到某仓单的信息,但rdors.EOF却为真,即无该仓单资料。
请各位达人帮忙看看,该函数的问题所在,多谢!
'-----------Function: Get FTN No exists status
'---------Parameters: sFTNNo : FTN No
'-------------------- sPart : Part No
'--------Create Date: 06/15/2010
Private Function GetFTNNo(ByVal sFTNNo As String, ByVal sPart As String) As Boolean
Dim strSQL As String
Dim rdors As RDO.rdoResultset
Dim bFirst As Boolean
Dim strLotNo As String
On Error GoTo Handle_Err
If cnQIMS.State = adStateClosed Then
cnQIMS.Open
End If
strLotNo = sFTNNo
If InStr(1, strLotNo, "R") > 0 Then
strLotNo = Left(strLotNo, Len(strLotNo) - 2)
End If
strSQL = "select ftnlot_nbr, ftnlot_remarks_2 from ftnlot_mstr where ftnlot_nbr like '" & strLotNo & "%'"
With cmdGetCompany
.Parameters("@part").Value = sPart
.Execute
If Trim(.Parameters("@company").Value) = "" Then
GetFTNNo = False
Remark = "Can not get company code"
Exit Function
End If
If Trim(.Parameters("@company").Value) = "welco" Then
Set rdors = cnWongDB.OpenResultset(strSQL, rdOpenForwardOnly, rdConcurReadOnly)
End If
If Trim(.Parameters("@company").Value) = "wellop" Then
Set rdors = cnWongDB.OpenResultset(strSQL, rdOpenForwardOnly, rdConcurReadOnly)
End If
End With
If Not rdors.EOF Then
GetFTNNo = False
Remark = Trim(rdors("ftnlot_remarks_2"))
Else
GetFTNNo = True
End If
Set rdors = Nothing
Exit Function
Handle_Err:
blOpenL1000DB = False
Set rdors = Nothing
GetFTNNo = False
Remark = ""
Err.Clear
End Function --------------------编程问答-------------------- 存在资料的判断不应该是用EOF吧? 若有3条记录目前在第二条,EOF不还是=false?
所以应该是判断逻辑选择有问题? --------------------编程问答-------------------- hu19867777:
我用的rdOpenForwardOnly属性, 那么rdors的记录必指向最后一条记录。则只要有记录集存在,rdors.eof 必定为假。谢谢! --------------------编程问答-------------------- 请高手进来看看,帮忙解决呀! --------------------编程问答-------------------- help me
补充:VB , 基础类