How do I create a new record in a database?

I am using the following code:

 Dim dr As DataRow dr = IdeaDataSet.TblManagers.NewRow() With dr .Item("MgrName") = MgrNameTextBox.Text .Item("Position") = PositionTextBox.Text .Item("E-mail") = E_mailTextBox.Text .Item("UserID") = UserIDTextBox.Text .Item("LevelFlag") = CheckBox End With Try IdeaDataSet.TblManagers.Rows.Add(dr) Catch ex As Exception End Try 

But it does not save it to the actual database.

The same happens when I try to update an existing record. I use the following code:

 Dim values() As Object = New Object() {Me.IdeaDataSet.TblManagers.Rows(row).Item("ManagerID"), MgrNameTextBox.Text, PositionTextBox.Text, E_mailTextBox.Text, UserIDTextBox.Text, CheckBox} For x = 1 To values.Count - 1 Me.IdeaDataSet.TblManagers.Rows(MgrCB.SelectedIndex).Item(x) = values(x) Next 

submitted by /u/EpicShaggy
[link] [comments]

Leave a Reply