Dim Te() As String ={"类别","辅料名称","单位"} ‘确定这些控件名称是正确的?’
For i As Integer = 0 To te.Length-1
If e.Form.Controls(te(i)).text = "" Then
MessageBox.Show( ""& te(i) &" 是空值,请输入 "& te(i) &"!","提醒")
Return
End If
Next
Dim r As Row = Tables("添加辅料_Table1").Current
if r is nothing then return 'Current必须判断是否为空
If r.Locked = True Then
r .Locked = False
End If
‘红色的这些代码一点用处都没有’
Dim cmd As New SQLCommand
Dim ds As DataTable
Dim cmb As WinForm.ComboBox
cmd.C
cmd.CommandText = "SELEC1T * From {辅料信息表}"
ds = cmd.ExecuteReader(True)
r("计量单位") = e.Form.Controls("单位").Value
r("辅料质地") = e.Form.Controls("辅料质地").Value
r("规格") = e.Form.Controls("规格").Value
r("辅料名称") = e.Form.Controls("辅料名称").Value
'r("辅料类别") = e.Form.Controls("类别").Value
'r("辅料编号") = e.Form.Controls("编号").text
With r '引用当前行
If .IsNull("辅料名称") = False Then '如果已经输入结账日期
.Locked = True '那么锁定此行
If DataTables("添加辅料_Table1").HasChanges Then
.Save
ds.Save
End If
Else
.Locked = False '那么锁定此行
ds.Save
End If
End With