now i am doing something that i thought would be real straight forward but for some reason is not.
Im trying to lookup records in a DB based on todays date. ow i know the db contains records for these dates but nothing ever gets returned. My code is below and i wondered if anyone had any ideas?
Dim sql As String
Dim Command As OleDbCommand
Dim con As System.Data.OleDb.OleDbConnection
Dim Searchds As New DataSet
Dim Searchda As OleDb.OleDbDataAdapter
Dim TodaysDate As Date
Dim RecordCount As Integer
con = New OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source = C:\cdr\ReferenceData.mdb")
con.Open()
TodaysDate = Format(Date.Today, "dd/MM/yyyy")
sql = "SELECT * FROM tblStay WHERE tblStay.ArriveDate = #" & TodaysDate & "#"
Command = New OleDbCommand(sql, con)
Command.ExecuteNonQuery()
Searchda = New OleDb.OleDbDataAdapter(sql, con)
Searchda.Fill(Searchds)
RecordCount = Searchds.Tables(0).Rows.Count
If RecordCount > 0 Then
For i = 0 To RecordCount - 1
lst1.Items.Add(Searchds.Tables(0).Rows(i).Item(1) & " : " & Searchds.Tables(0).Rows(i).Item(3))
Next
End If
con.Close()