Rss & SiteMap

Foxtable(狐表) http://www.foxtable.com

新一代数据库软件,完美融合Access、Foxpro、Excel、vb.net之优势,人人都能掌握的快速软件开发工具!
共7 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:谁能看卡这段代码有什么问题吗?~求帮助

1楼
zbsczh 发表于:2011/6/17 12:23:00

Dim c1 As WinForm.ComboBox
Dim c2 As WinForm.TextBox


c1 = e.Form.Controls("ComboBox1")
c2 = e.Form.Controls("TextBox1")

Dim s1 As String = c1.Value
Dim s2 As String = c2.Value
Dim r As Integer

If s2 IsNot Nothing Then
    Select Case s1
        Case "物料号"
            r = Tables("库存").FindRow("[物料号] = " & s2, 0, True)
            If r >= 0 Then
                CurrentTable.Position = r
            Else
                MessageBox.Show("  输入的物料号不存在!", "提示", MessageBoxButtons.OK,MessageBoxIcon.Information)
            End If
        Case "物料名称"
            r = Tables("库存").FindRow("[物料名称] = " & s2 , 0, True)
            If r >= 0 Then
                CurrentTable.Position = r
            Else
                MessageBox.Show("  输入的物料名称不存在!", "提示", MessageBoxButtons.OK,MessageBoxIcon.Information)
            End If
    End Select
Else
    MessageBox.Show("    请输出查找内容!", "提示", MessageBoxButtons.OK,MessageBoxIcon.Information)
End If

 

 

一直在             r = Tables("库存").FindRow("[物料名称] = " & s2 , 0, True)

这行出错。。不懂了

2楼
程兴刚 发表于:2011/6/17 12:51:00
缺少单引号,看帮助,我用手机回复的!
[此贴子已经被作者于2011-6-17 12:54:21编辑过]
3楼
zbsczh 发表于:2011/6/17 12:57:00

            r = Tables("库存").FindRow("[物料名称] = " & s2 , 0, True)
     r = Tables("库存").FindRow("[物料号] = " & s2, 0, True)

两条代码都一样的,为什么一条出错,一条没出错。。

4楼
zbsczh 发表于:2011/6/17 12:58:00
而且也不是单引号的问题吧。。
5楼
zbsczh 发表于:2011/6/17 13:52:00

狐爸在不

6楼
mr725 发表于:2011/6/17 13:59:00
以下是引用zbsczh在2011-6-17 12:57:00的发言:

            r = Tables("库存").FindRow("[物料名称] = " & s2 , 0, True)
     r = Tables("库存").FindRow("[物料号] = " & s2, 0, True)

两条代码都一样的,为什么一条出错,一条没出错。。

物料名称、物料号这两个字段类型?  如果是字符型,那么:" & s2  改为: '" & s2 & "'

 

另外:If s2 IsNot Nothing Then  不知道对不,我都是If s2 > "" Then  或 If s2 <> "" Then   这样用的。

7楼
zbsczh 发表于:2011/6/17 14:05:00

谢谢楼上大哥指导,问题解决了,确实如此, NOthing 判断没问题。就是奇怪,本来S2变量带的就是字符类型,怎么还加单引号''。。。。

共7 条记录, 每页显示 10 条, 页签: [1]

Copyright © 2000 - 2018 foxtable.com Tel: 4000-810-820 粤ICP备11091905号

Powered By Dvbbs Version 8.3.0
Processed in .02734 s, 2 queries.