Firstly i am using VB2005 and MS Access 2002. Ok so I am using the executeReader to attempt to read all records between two sets of dates.
However, i only appear to be getting one record. When i then try contactReader.nextResult, it returns false.
I have double checked and there is definatly more than one record in that time frame. Im not sure if i am doing something incorrect since I am a newbie.
The sql string comes together as:Code:sql = "select * from dailyTable where recDate BETWEEN #" & startDate & "# AND #" & endDate & "#" Dim command As New OleDbCommand(sql, conn) conn.Open() Dim contactReader As OleDbDataReader = command.ExecuteReader() contactReader.Read() MsgBox(contactReader("grossSales").ToString, MsgBoxStyle.AbortRetryIgnore) MsgBox(contactReader.NextResult, MsgBoxStyle.Critical) conn.Close()
"select * from dailyTable where recDate BETWEEN #19/03/2007# AND #25/03/2007#"
I know the date appears to be in the wrong format, i.e dd/mm instead of mm/dd, but this has not been a problem in the rest of my program.
VB seems to convert it to this format when using SQL statements, since endDate =#3/25/2007# when not in the SQL statement.
Many thanks in advance




Reply With Quote