Public Class Form1 Dim con As New OleDb.OleDbConnection Dim da, da1 As OleDb.OleDbDataAdapter Dim ds, ds1 As New DataSet Dim s As New connect.Class1 Dim i, j As Integer Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load con.ConnectionString = s.a1 con.Open() da1 = New OleDb.OleDbDataAdapter("Select Dat from Sale", con) da1.Fill(ds1, "Tab") i = ds1.Tables("Tab").Rows.Count For j = 0 To i - 1 ComboBox3.Items.Add(ds1.Tables("Tab").Rows(j).Item(0)) Next End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If RadioButton1.Checked = True Then Dim cmb As String cmb = Trim(ComboBox3.Text) 'cmb = DateTimePicker1.Text ds.Clear() 'da = New OleDb.OleDbDataAdapter("Select * from Sale where Dat='" & cmb & "'", con) da = New OleDb.OleDbDataAdapter("Select * from Sale where Dat='" & cmb & "'", con) da.Fill(ds, "Tab") con.Close() DataGridView1.DataSource = ds.Tables("Tab").DefaultView DataGridView1.Show() End If End Sub End Class Namespace connect Public Class Class1 Public a1 As String = "Provider=microsoft.jet.oledb.4.0;data source=D:\CDshop.mdb" End Class End Namespace
cmb = DateTimePicker1.Value.ToString("yyyy-MM-dd") 'Replace the format(yyyy-MM-dd) with what you have in access database
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)