做了个窗体,"TextBox1"中放着订单号(绑定订单表),"Table1"中放着订单.订单明细表,窗体中还有个Button2做为确定按钮。订单明细表中有两个逻辑列,“待发运”和“发运”。
希望在Table1中将“待发运”勾选,按确定后“,该订单号对应的订单明细中的“发运”自动勾选。
参照帮助文件
再谈Table和DataTable
中的示例六,在Button2的Click中写了如下程序,
但是,没有第一段程序的情况下,订单表中所有”待发运“=True的“发运”都被勾选了;
加了第二段程序,总提示错误“从字符串“待发运”=True到类型“long”的转换无效”。这是什么意思?该如何修改??
Dim Fa As String
With e.Form.Controls("TextBox1")
If .Value IsNot Nothing Then
Fa = .Value
End If
End With
Dim drs As List(Of DataRow)
'drs = DataTables("订单.订单明细").Select("[待发运] = True")
drs = DataTables("订单.订单明细").Select("[待发运] = True" And "[订单号]=Fa")
For Each dr As DataRow In drs
dr("发运") = True
Next
[此贴子已经被作者于2012-11-11 11:10:58编辑过]