Dim tb1 As WinForm.TextBox = e.Form.Controls("TextBox1")
Dim tb2 As WinForm.TextBox = e.Form.Controls("TextBox2")
Dim lb1 As WinForm.Label = e.Form.Controls("Label3")
Dim cmd As New SQLCommand
Dim dt As DataTable
cmd.C
cmd.CommandText = "SELECT * Fro m {颜色对照表}"
dt = cmd.ExecuteReader(True)
If tb1.Value <> "" And tb2.Value <> "" And lb1.text <> "" Then
Dim Result As DialogResult
Result = MessageBox.Show("是否需要继续增加颜色数据?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If Result = DialogResult.Yes Then
Dim dr As DataRow = dt.AddNew()
dr("颜色") = tb1.Value
dr("色号") = tb2.Value
dr("代码") = lb1.text
If dt.HasChanges Then
dr.Save()
dr.load()
End If
tb1.Value = ""
tb2.Value = ""
lb1.text = ""
Else
Dim dr As DataRow = dt.AddNew()
dr("颜色") = tb1.Value
dr("色号") = tb2.Value
dr("代码") = lb1.text
If dt.HasChanges Then
dr.Save()
dr.load()
End If
Forms("窗口6").Close()
End If
Else
Forms("窗口6").Close()
End If
此主题相关图片如下:01.jpg
此主题相关图片如下:02.jpg
看看代码没什么问题啊,错在哪里呢?