I have a form that shows users data from a sql query. What I want to be able to do is when users make a change, they press a save button, the edited/changed data is saved to a new table and then the window is closed. I've looked for several tutorials for this. Can anyone give me an example of a good tutorial or a code example?
My database that the user would be saving to is called exceptionsedit.
The code I have this far is this:
But from how I understand how datagridviews work, that the user can edit in the form without having to click on save.
My database that the user would be saving to is called exceptionsedit.
The code I have this far is this:
Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles saveButton.Click
Dim sql As String = "Insert * Into ExceptionsEdit"
Dim oCmd As System.Data.SqlClient.SqlCommand
Dim oDr As System.Data.SqlClient.SqlDataReader
oCmd = New System.Data.SqlClient.SqlCommand
Try
With oCmd
.Connection = New System.Data.SqlClient.SqlConnection("Initial Catalog=mdr;Data Source=xxxxx;uid=xxxxx;password=xxxxx")
.Connection.Open()
.CommandType = CommandType.Text
oDr = .ExecuteReader()
End With
oDr.Close()
oCmd.Connection.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
oCmd.Connection.Close()
End Try
Close()
saveButton.Enabled = False
End Sub