Advertisement
binjeeclick

binding

Dec 8th, 2018
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 0.75 KB | None | 0 0
  1. Imports MySql.Data.MySqlClient
  2. Public Class Form1
  3.     Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  4.         Dim str As String = "server='localhost';" _
  5.                                 & "user id='root';" _
  6.                                 & "password='';" _
  7.                                 & "database='db_kenalan';"
  8.  
  9.         Dim sql As String = "SELECT * FROM list_kenalan"
  10.         Dim connection As New MySqlConnection(str)
  11.         Dim dataadapter As New MySqlDataAdapter(sql, connection)
  12.         Dim ds As New DataSet()
  13.         connection.Open()
  14.         dataadapter.Fill(ds, "list_kenalan")
  15.         connection.Close()
  16.         DataGridView1.DataSource = ds
  17.         DataGridView1.DataMember = "list_kenalan"
  18.     End Sub
  19. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement