以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 【求助】如何实现一个文本框扫描然后多个表查找数据 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=108820) |
-- 作者:李孝春 -- 发布时间:2017/10/30 13:58:00 -- 【求助】如何实现一个文本框扫描然后多个表查找数据 当前生成了两种二维码 一种是卷宗二维码 一种是物品二维码 两个二维码不同 如何实现一个文本框,使用扫描枪识别二维码字符后, 对应在【卷宗入库】【涉案款物】两个表去找数据呢? 入库明细表里面有卷宗编号列 款物明细表里面有案件编号列 且等于入库明细表中的卷宗编号列 代码如下:【怎么修正呢使之实现上述要求呢?】 If e.keycode = 13 Then Dim te1 As WinForm.TextBox = e.Form.Controls("TextBox1") Dim ab As String = te1.text Dim dr As DataRow Dim Filter As String Filter =" [加密字符] =\'" & ab & "\'" dr = DataTables("入库明细").sqlFind(Filter) Dim dr1 As DataRow dr1 = DataTables("款物明细").sqlFind(Filter) If dr IsNot Nothing Then \'如果找到 Tables("卷宗入库").Filter= "[卷宗编号] = \'" & dr("卷宗编号") & "\' " Else MessageBox.Show("当前二维码无数据记录,请核查是否为正确二维码!") Tables("卷宗入库").Filter="" End If If dr1 IsNot Nothing Then \'如果找到 Tables("涉案款物").Filter= "[案件编号] = \'" & dr1("案件编号") & "\' " Else MessageBox.Show("当前二维码无数据记录,请核查是否为正确二维码!") Tables("涉案款物").Filter="" End If e.Sender.text = "" e.Sender.Select e.cancel = True e.cancel = True End If
[此贴子已经被作者于2017/10/30 16:41:23编辑过]
|
-- 作者:有点甜 -- 发布时间:2017/10/30 14:22:00 -- If e.keycode = 13 Then e.Sender.Select e.cancel = True Dim te1 As WinForm.TextBox = e.Form.Controls("TextBox1") Dim ab As String = te1.text Dim dr As DataRow Dim Filter As String Filter =" [加密字符] =\'" & ab & "\'" dr = DataTables("入库明细").sqlFind(Filter) If dr IsNot Nothing Then \'如果找到 Tables("卷宗入库").Filter= "[卷宗编号] = \'" & dr("卷宗编号") & "\' " Else If dr Is Nothing Then dr = DataTables("款物明细").sqlFind(Filter) If dr IsNot Nothing Then \'如果找到 Tables("涉案款物").Filter= "[案件编号] = \'" & dr("案件编号") & "\' " Else MessageBox.Show("当前二维码无数据记录,请核查是否为正确二维码!") Return End If End If End If e.Sender.text = "" End If |
-- 作者:李孝春 -- 发布时间:2017/10/30 16:42:00 -- 回复:(有点甜)If e.keycode = 13 Then ... 谢谢 最终修正如下 效果完美实现 If e.keycode = 13 Then e.Sender.Select e.cancel = True Dim te1 As WinForm.TextBox = e.Form.Controls("TextBox1") Dim ab As String = te1.text Dim dr As DataRow Dim Filter As String Filter =" [加密字符] =\'" & ab & "\'" dr = DataTables("入库明细").sqlFind(Filter) If dr IsNot Nothing Then \'如果找到 Tables("卷宗入库").Filter= "[卷宗编号] = \'" & dr("卷宗编号") & "\' " Tables("涉案款物").Filter= "[案件编号] = \'" & dr("卷宗编号") & "\' " Else If dr Is Nothing Then dr = DataTables("款物明细").sqlFind(Filter) If dr IsNot Nothing Then \'如果找到 Tables("涉案款物").Filter= "[案件编号] = \'" & dr("案件编号") & "\' " Tables("卷宗入库").Filter= "[卷宗编号] = \'" & dr("案件编号") & "\' " Else MessageBox.Show("当前二维码无数据记录,请核查是否为正确二维码!") Return End If End If End If e.Sender.text = "" End If |