download gratis video tutorial vb 6 dan vb.net plus contoh aplikasi

cara memfilter data dalam datagridview

 

 

 


Imports System.Data.SqlClient

 

Public Class sqlserver2005

Dim conn As SqlConnection
Dim da As SqlDataAdapter
Dim ds As DataSet

 

Sub koneksi()
conn = New SqlConnection("data source=user-pc\sqlexpress;initial catalog=mydbagain;integrated security=true")
conn.Open()
End Sub

 

Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox2.TextChanged
Call koneksi()
da = New SqlDataAdapter("select * from tblbarang where nama_barang like '%" & TextBox2.Text & "%' OR satuan like '%" & TextBox2.Text & "%'", conn)
ds = New DataSet
da.Fill(ds)
DGV.DataSource = ds.Tables(0)
DGV.ReadOnly = True
End Sub
End Class