重新发贴,请求大侠帮助!

ncoxwwz 2010-07-19 09:11:31
问题描述:
此函数用来查询仓单在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
...全文
83 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
jhone99 2010-07-19
  • 打赏
  • 举报
回复
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 & "%'"

Debug.Print strSQL '输出拿到数据库运行

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
ncoxwwz 2010-07-19
  • 打赏
  • 举报
回复
断点调试有执行,但数据库里明明有记录的。但就是返回不了值,不知为何?
ldy888 2010-07-19
  • 打赏
  • 举报
回复
发错贴了,楼主无视之
ldy888 2010-07-19
  • 打赏
  • 举报
回复
南京话和“吴侬软语”一点边都沾不上,楼主要有心理准备
jhone99 2010-07-19
  • 打赏
  • 举报
回复
哦,我错了,你这么写也可以,你设断点调试看看是否执行了这两个
jhone99 2010-07-19
  • 打赏
  • 举报
回复
'        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


这两个什么关系,你这么写肯定不对
ncoxwwz 2010-07-19
  • 打赏
  • 举报
回复
记录肯定不会并存的。只会满足之一的条件。
Debug.Print rdors.recordcount 返回值为 0
jhone99 2010-07-19
  • 打赏
  • 举报
回复
'问题描述:
'此函数用来查询仓单在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

'是要这个?
If Trim(.Parameters("@company").Value) = "welco" Then
Set rdors = cnWongDB.OpenResultset(strSQL, rdOpenForwardOnly, rdConcurReadOnly)
ElseIf Trim(.Parameters("@company").Value) = "wellop" Then
Set rdors = cnWongDB.OpenResultset(strSQL, rdOpenForwardOnly, rdConcurReadOnly)
End If

'------------
End With

Debug.Print rdors.recordcount '加这个看输出,是否有记录?

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
你想当“李逍遥”式的“大侠”吗? 这里无需计算机基础,无需编程经验,你也不必是计算机专业的在校大学生....只要爱好游戏,怀揣梦想! 有一定自主学习能力,跟着刘老师从“编程小白”修炼为游戏研发“大虾”吧!!!学习好Unity,其先决条件是一定要有稳固、扎实的编程基础!课程 《C# For Unity系列之入门篇》配套学习资料链接:http://pan.baidu.com/s/1gflxreN 密码:sou5;刘老师讲Unity学员群(2) 497429806一、热更新系列(技术含量:中高级):A:《lua热更新技术中级篇》https://edu.csdn.net/course/detail/27087B:《热更新框架设计之Xlua基础视频课程》https://edu.csdn.net/course/detail/27110C:《热更新框架设计之热更流程与热补丁技术》https://edu.csdn.net/course/detail/27118D:《热更新框架设计之客户端热更框架(上)》https://edu.csdn.net/course/detail/27132E:《热更新框架设计之客户端热更框架(中)》https://edu.csdn.net/course/detail/27135F:《热更新框架设计之客户端热更框架(下)》https://edu.csdn.net/course/detail/27136二:框架设计系列(技术含量:中级): A:《游戏UI界面框架设计系列视频课程》https://edu.csdn.net/course/detail/27142B:《Unity客户端框架设计PureMVC篇视频课程(上)》https://edu.csdn.net/course/detail/27172C:《Unity客户端框架设计PureMVC篇视频课程(下)》https://edu.csdn.net/course/detail/27173D:《AssetBundle框架设计_框架篇视频课程》https://edu.csdn.net/course/detail/27169三、Unity脚本从入门到精通(技术含量:初级)A:《C# For Unity系列之入门篇》https://edu.csdn.net/course/detail/4560B:《C# For Unity系列之基础篇》https://edu.csdn.net/course/detail/4595C: 《C# For Unity系列之中级篇》https://edu.csdn.net/course/detail/24422D:《C# For Unity系列之进阶篇》https://edu.csdn.net/course/detail/24465四、虚拟现实(VR)与增强现实(AR):(技术含量:初级)A:《虚拟现实之汽车仿真模拟系统 》https://edu.csdn.net/course/detail/26618五、Unity基础课程系列(技术含量:初级) A:《台球游戏与FlappyBirds—Unity快速入门系列视频课程(第1部)》 https://edu.csdn.net/course/detail/24643B:《太空射击与移动端发布技术-Unity快速入门系列视频课程(第2部)》https://edu.csdn.net/course/detail/24645 C:《Unity ECS(二) 小试牛刀》https://edu.csdn.net/course/detail/27096六、Unity ARPG课程(技术含量:初中级):A:《MMOARPG地下守护神_单机版实战视频课程(上部)》https://edu.csdn.net/course/detail/24965B:《MMOARPG地下守护神_单机版实战视频课程(中部)》https://edu.csdn.net/course/detail/24968C:《MMOARPG地下守护神_单机版实战视频课程(下部)》https://edu.csdn.net/course/detail/24979

7,762

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧