[VB] Datagrid

Skilled Illusionist
Joined
Jan 14, 2005
Messages
395
Reaction score
2
Hello,
i am working on a control program to manage my game but i was wondering how i could save the field i selected afther i changed the field value

this is what i have :

Code:
 Dim myConnString = "Database=testingdatabase; Data Source=localhost; User Id='root'; Password=''"
            Dim conn As New MySqlConnection
            Dim myCommand As New MySqlCommand
            Dim myAdapter As New MySqlDataAdapter
            Dim myData As New DataTable
            Dim SQL As String

            SQL = ""

            If ListBox3.SelectedItem = "Accounts" Then
                SQL = "SELECT * FROM accounts"
            ElseIf ListBox3.SelectedItem = "Tribes" Then
                SQL = "SELECT * FROM tribes"
            End If

            conn.ConnectionString = myConnString

            Try
                conn.Open()

                Try
                    myCommand.Connection = conn
                    myCommand.CommandText = SQL

                    myAdapter.SelectCommand = myCommand
                    myAdapter.Fill(myData)

                    dgvStatus.DataSource = myData
                    dgvStatus.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells
                Catch myerror As MySqlException
                    MsgBox("Het is helaas niet gelukt om een goed resultaat te krijgen dit was de error: " & myerror.Message)
                End Try
            Catch myerror As MySqlException
                MessageBox.Show("De Verbinding is niet gelukt dit is de reden: " & myerror.Message)
            Finally
                If conn.State <> ConnectionState.Closed Then conn.Close()
            End Try

Greetz passie

P.S. R.I.P. Akaruz :(:
 
Back