Hi Everyone,
In one of my units I have an ADOQuery component, which I initialize like so:
The query is run 5 times in a loop, with 'day' being Monday through Friday.I have 3 entries in the database which should match the 'Monday' iteration, one for 'Tuesday'and none for the rest, however ADOQuery1.RecNo equals 1, then 1 again, then -1!
I noted the exact syntax of the sql query at run time and ran it in access, which worked perfectly.
Can anybody think what is causing this? Queries called from other units work fine.
Many thanks
In one of my units I have an ADOQuery component, which I initialize like so:
Code:
with ADOQuery1 do begin
Close;
ConnectionString := 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source='+frm_Technician.databaselocation+'btbse_ScienceBookings.mdb;Persist Security Info=False';
SQL.Clear;
SQl.Text := 'SELECT * FROM tbl_Bookings WHERE [WeekBeginning] = '''+frm_Technician.cmb_WeekBeginning.text+''' AND [Day] = '''+TheWeek[day]+''' ORDER BY [Period];';
Active := true;
Open;
end;
The query is run 5 times in a loop, with 'day' being Monday through Friday.I have 3 entries in the database which should match the 'Monday' iteration, one for 'Tuesday'and none for the rest, however ADOQuery1.RecNo equals 1, then 1 again, then -1!
I noted the exact syntax of the sql query at run time and ran it in access, which worked perfectly.
Can anybody think what is causing this? Queries called from other units work fine.
Many thanks