Hey,i am working on a module in vb 10..i have to retrive data from the database between two dates...i have used the following code but not able to get ny output,,nt even an error
Imports System.Data.OleDb
Public Class Form4
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=C:/Users/Space Era/Documents/perf.mdb")
con.Open()
Dim dataset1 As New DataSet()
Dim datagridview1 As New DataGridView
Dim sqlstring As String = "select * from data where Date >= '" & DateTimePicker2.Text & "' and Date<= ' " & DateTimePicker1.Text & "'"
cmd = New OleDbCommand(sqlstring, con)
Dim oledbdataadapter1 As System.Data.OleDb.OleDbDataAdapter = New System.Data.OleDb.OleDbDataAdapter(sqlstring, con)
oledbdataadapter1.Fill(dataset1, "data")
datagridview1.DataSource = dataset1.Tables("data")
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
con.Close()
End Sub
End Class