Foxtable(狐表)用户栏目专家坐堂 → 帮我看一下 哪里出错了 谢谢


  共有2541人关注过本帖树形打印复制链接

主题:帮我看一下 哪里出错了 谢谢

帅哥哟,离线,有人找我吗?
jswjyjf
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:九尾狐 帖子:2552 积分:20045 威望:0 精华:0 注册:2012/5/19 11:57:00
帮我看一下 哪里出错了 谢谢  发帖心情 Post By:2020/4/8 19:37:00 [只看该作者]

帮我看一下 哪里出错了 谢谢  出错说找不到cpbm  
 Dim dr As Row
    dr = Tables("货品").current
    DataTables("货品目录表").SQLDeleteFor("产品货号='" & dr("货号") & "'")
    DataTables("货品目录表").RemoveFor("产品货号='" & dr("货号") & "'")
    Dim nms() As String = dr("颜色").Split(",")
    Dim nms2() As String = dr("尺码").Split(",")
    For Each name As String In Nms
        For Each name2 As String In Nms2
 ''读取颜色和尺码的编码 用于定义产品编码
Dim dr1 As DataRow= DataTables("颜色").SQLFind("名称 ='" & name & "'") '找出编号为03的产品
Dim dr2 As DataRow= DataTables("尺码").SQLFind("名称 ='" & name2 & "'") '找出编号为03的产品
If dr1 IsNot Nothing And dr2 IsNot Nothing
Dim cpbm As String=dr("货号")&"-"&dr1("编码")&"-"&dr2("编码")
End If 
msgbox(cpbm)  


 回到顶部
帅哥,在线噢!
有点蓝
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:106349 积分:540886 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2020/4/9 9:05:00 [只看该作者]

变量是有作用域的。在if里面定义的变量只能在if里面使用

Dim abc As String= xxx 在if外面定义的变量
if xxxx条件 then
   Dim cpbm As String= xxx ‘’在if里面定义的变量
msgbox(cpbm)  在if里面使用,是正确的
msgbox(abc )  在if里面使用,是正确的
end if
msgbox(cpbm)  在if外面使用,是错误的
msgbox(abc)  在if外面使用,是正确的


 回到顶部