'declare the needed variables Dim idCon As New OleDbConnection Dim idSQL As String Dim idSet As New DataSet 'start the connection idCon.ConnectionString = "PROVIDER = Microsoft.Jet.OleDb.4.0; data source = Library2.mdb; Jet OLEDB:Database Password = 3Musketeers" idSQL = "SELECT * FROM Newtransaction" 'declare and assign a value to a dataadapter Dim idAdapt As New OleDbDataAdapter(idSQL, idCon) 'open the connection Dim mytable As DataTable = New DataTable() idCon.Open() 'fill data to datable idAdapt.Fill(idSet, "suckz") dGrid.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing 'setting columnheadername idSet.Tables("suckz").Columns(0).ColumnName = "T CODE" idSet.Tables("suckz").Columns(1).ColumnName = "BOOK CODE" idSet.Tables("suckz").Columns(2).ColumnName = "MEMBER CODE" idSet.Tables("suckz").Columns(3).ColumnName = "ISSUED_DATE" idSet.Tables("suckz").Columns(4).ColumnName = "RETURNED DATE" idSet.Tables("suckz").Columns(5).ColumnName = "COMMENTS" idSet.Tables("suckz").Columns(6).ColumnName = "PENALTY" BindingSource1.DataSource = idSet.Tables("suckz") BindingSource1.Filter = String.Format("ISSUED_DATE LIKE '{0}%'", txtSearch.Text) dGrid.DataSource = BindingSource1 dGrid.Update() dGrid.Refresh() idCon.Close()
"SELECT * FROM Newtransaction"
SELECT * FROM Newtransaction WHERE [DateField] = #2012/06/01#
SELECT * FROM Newtransaction WHERE [DateField] BETWEEN #2012/05/01# AND #2012/05/31#
idSQL = "SELECT * FROM Newtransaction where isDate "
idSQL = "SELECT * FROM Newtransaction where isDate ='DATE'"
idSQL = "SELECT * FROM Newtransaction"
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)