User
User
User
Odbc
Public Class user
'kodingan sub
Sub tampilGrid()
Call koneksi()
da = New OdbcDataAdapter("select id_user, nama_lengkap, status,
email, alamat, no_telepon from user", conn)
ds = New DataSet
da.Fill(ds)
DGV.DataSource = ds.Tables(0)
DGV.ReadOnly = True
DGV.Columns("id_user").Width = 100
DGV.Columns("nama_lengkap").Width = 120
DGV.Columns("status").Width = 95
DGV.Columns("email").Width = 100
DGV.Columns("alamat").Width = 100
DGV.Columns("no_telepon").Width = 100
End Sub
Sub panggilKode()
Call koneksi()
cmd = New OdbcCommand("select * from user where id_user='" &
TextBox1.Text & "'", conn)
dr = cmd.ExecuteReader
dr.Read()
End Sub
Sub panggilData()
On Error Resume Next
TextBox2.Text = dr("nama_lengkap")
TextBox3.Text = dr("password")
ComboBox1.Text = dr("status")
TextBox4.Text = dr("email")
TextBox5.Text = dr("no_telepon")
TextBox6.Text = dr("alamat")
End Sub
Sub hapus()
TextBox2.Clear()
TextBox3.Clear()
ComboBox1.Text = ""
TextBox4.Clear()
TextBox5.Clear()
TextBox6.Clear()
End Sub
Sub caridata()
Call koneksi()
da = New OdbcDataAdapter("select id_user, nama_lengkap, status,
email, alamat, no_telepon from user where id_user like '%" & TextBox7.Text
& "%' or nama_lengkap like '%" & TextBox7.Text & "%' or email like '%" &
TextBox7.Text & "%' or alamat like '%" & TextBox7.Text & "%' or status like
'%" & TextBox7.Text & "%' or no_telepon like '%" & TextBox7.Text & "%'",
conn)
ds = New DataSet
da.Fill(ds)
DGV.DataSource = ds.Tables(0)
DGV.ReadOnly = True
End Sub
'kodingan textbox
If dr.HasRows Then
Call panggilData()
Else
Call hapus()
End If
End If
End Sub
'kodingan combobox
'kodingan button
Call panggilKode()
'caridata