Users既然是内部表,就用AddNew来增加行:
Dim UserName As String = e.Form.Controls("UserName").Value
Dim UserGroup As String = e.Form.Controls("UserGroup").Value
Dim PassWord As String = e.Form.Controls("PassWord").Value
Dim cmd As New SQLCommand
'cmd.C
If UserName = "" OrElse UserGroup = "" Then
Messagebox.show("请输入用户名和用户分组!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
Return
End If
Dim dr As DataRow = DataTables("Users").AddNew
dr("Name")= UserName
dr("Group") = UserGroup
dr("Password") = Password
dr.Save()
With Forms("用户管理").Controls("ListBox1")
.Items.Add(UserName)
.SelectedIndex = .Items.Count -1
End With