Public Class Form1
Dim connetionString As String
Dim connection As MySqlConnection
Dim adapter As MySqlDataAdapter
Dim cmdBuilder As MySqlCommandBuilder
Dim ds As New DataSet
Dim changes As DataSet
Dim sql As String
Dim i As Int32
Private Sub BekijkAllesToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BekijkAllesToolStripMenuItem.Click
Dim connetionString As String = ("Data Source=site;Initial Catalog=catalog;User ID=id;Password=pw")
connection = New MySqlConnection(connetionString)
sql = "select * from Herstellingen2"
Try
connection.Open()
adapter = New MySqlDataAdapter(sql, connection)
adapter.Fill(ds)
connection.Close()
Herstellingen.DataSource = ds.Tables(0)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub SaveToolStripButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveToolStripButton.Click
Try
cmdBuilder = New MySqlCommandBuilder(adapter)
changes = ds.GetChanges()
If changes IsNot Nothing Then
adapter.Update(changes)
End If
MsgBox("Opgeslagen")
Catch ex As Exception
MsgBox(ex.ToString)
End Try
|