cara membuat query dinamis dengan vb.net
Coding :
Imports System.Data.OleDb
Public Class Form1
Dim conn As OleDbConnection
Dim da As OleDbDataAdapter
Dim ds As DataSet
Sub koneksi()
conn = New OleDbConnection("provider=microsoft.jet.oledb.4.0;data source=dbpenjualan.mdb")
conn.Open()
End Sub
Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
If e.KeyCode = Keys.Enter Then
koneksi()
Try
da = New OleDbDataAdapter(TextBox1.Text, conn)
ds = New DataSet
da.Fill(ds)
dgv.DataSource = ds.Tables(0)
dgv.ReadOnly = True
Catch ex As Exception
MsgBox(ex.Message)
End Try
End If
End Sub
End Class