HAI!
CAN ANYONE HELP ME TO RETREIVE DATA BETWEEN TWO DATES FROM MS-ACCESS USING VB.NET.
I HAVE TAKEN DATETIMEPICKER CONTROLS. THIS IS THE CODE . ITS RETURS ERROR.
PLEASE SOLVE THIS PROBLEM.
Imports System.Data.OleDb
Public Class Form7
Dim con As OleDbConnection
Dim cmd As OleDbCommand
Dim dr As OleDbDataReader
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
con = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=db2.mdb;")
Dim dataset1 As New DataSet()
Dim ddate1 As Date = DateTimePicker1.Text
Dim ddate2 As Date = DateTimePicker2.Text
'Dim sqlstring As String = "select * from enq1 where ddate >= '" & ddate1 & "' AND ddate <= '" & ddate2 & "'"
cmd = New OleDbCommand(sqlstring, con)
Dim oledbdataadapter1 As System.Data.OleDb.OleDbDataAdapter = New System.Data.OleDb.OleDbDataAdapter(sqlstring, con)
con.Open()
oledbdataadapter1.Fill(dataset1, "enq1")
DataGridView1.DataSource = dataset1.Tables("enq1")
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
con.Close()
End Sub
End Class