Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Dim sql As String
- Dim registos As MySqlDataReader
- Dim adaptador As New MySqlDataAdapter
- Dim dados As New DataTable
- 'Dim ds As New DataSet
- Dim bsource As New BindingSource
- Dim conexao As New MySqlConnection()
- conexao.ConnectionString = "SERVER=localhost; user=root; password='';database=bd_loja" ' atribui a string de ligação a conexão a BD
- sql = "SELECT * FROM clientes"
- Try
- conexao.Open()
- Dim comando As MySqlCommand = New MySqlCommand(sql, conexao)
- adaptador.SelectCommand = comando
- adaptador.Fill(dados)
- bsource.DataSource = dados
- cons_clientes.DataSource = bsource
- adaptador.Update(dados)
- conexao.Close()
- Catch ex As Exception
- MessageBox.Show("Erro ao tentar ler a DB", ex.Message)
- Finally
- conexao.Dispose()
- End Try
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement