MySqlDataReader in VB Express 2010
atas sendiri tambah command berikut
Imports MySql.Data.MySqlClient
Private Sub Tampil()
Dim conn As New MySql.Data.MySqlClient.MySqlConnection
If conn.State = ConnectionState.Closed Then
Dim myString As String = "server=localhost;user=root;password=;database=dbName"
Try
conn.ConnectionString = myString
conn.Open()
Catch ex As MySql.Data.MySqlClient.MySqlException
MsgBox(ex.Message)
End
End Try
End If
Dim cmd As New MySql.Data.MySqlClient.MySqlCommand
nis.Text = grid.Item(0, grid.CurrentRow.Index).Value
cmd.CommandText = "SELECT * from datasiswa where nis='" & nis.Text & "'"
cmd.Connection = conn
Dim reader As MySqlDataReader = cmd.ExecuteReader()
While reader.Read
nama.Text = reader("nama")
End While
End Sub