Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » DBISAM Technical Support » Support Forums » DBISAM SQL » View Thread |
Messages 1 to 9 of 9 total |
Dates in SQL |
Mon, Jul 23 2007 3:47 PM | Permanent Link |
"Bobby Gallagher" | Hi
I am using the following code to open a query extract from SQL script Select * FROM EVENTS Where EventDate Between :ADate1 and :ADate2 order by eventdate in the program code ------------------------ dmMain.qEvents.Active := False; dmMain.qEvents.ParamByName('ADate1').AsDateTime := StrToAnsiDate('2007-08-01'); dmMain.qEvents.ParamByName('ADate2').AsDateTime := StrToAnsiDate('2007-08-30'); dmMain.qEvents.Active := True; When I try this it runs fine if there are records in the result set but gives an exception error EConvertError - "'is not a valid date' Can anyone help please Regards Bobby |
Mon, Jul 23 2007 4:03 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Bobby,
<< dmMain.qEvents.Active := False; dmMain.qEvents.ParamByName('ADate1').AsDateTime := StrToAnsiDate('2007-08-01'); dmMain.qEvents.ParamByName('ADate2').AsDateTime := StrToAnsiDate('2007-08-30'); dmMain.qEvents.Active := True; When I try this it runs fine if there are records in the result set but gives an exception error EConvertError - "'is not a valid date' >> Are you always using the above dates ? On what line is the EConvertError occurring - on the ParamByName assignment or during the SQL execution ? Also, are you using 3.x or 4.x here ? -- Tim Young Elevate Software www.elevatesoft.com |
Mon, Jul 23 2007 4:05 PM | Permanent Link |
"Bobby Gallagher" | Sorry
I did not finish the last post properly I meant to say > When I try this it runs fine if there are records in the result set but > gives an exception error EConvertError - "'is not a valid date' is the > resultset is empty Regards Bobby "Bobby Gallagher" <bobgal@computech.ie> wrote in message news:00EEF556-7153-468D-A2E5-AA75210D1489@news.elevatesoft.com... > Hi > > I am using the following code to open a query > > extract from SQL script > Select * > FROM EVENTS > Where EventDate Between :ADate1 and :ADate2 > order by eventdate > > in the program code > ------------------------ > dmMain.qEvents.Active := False; > dmMain.qEvents.ParamByName('ADate1').AsDateTime := > StrToAnsiDate('2007-08-01'); > dmMain.qEvents.ParamByName('ADate2').AsDateTime := > StrToAnsiDate('2007-08-30'); > dmMain.qEvents.Active := True; > > When I try this it runs fine if there are records in the result set but > gives an exception error EConvertError - "'is not a valid date' > > Can anyone help please > > Regards > > Bobby > > > |
Mon, Jul 23 2007 4:30 PM | Permanent Link |
"Bobby Gallagher" | Hi Tim
Sorry - should have said - V3.30 I have tried 2 options - 1 standard query with 2 parameters - startdate and finishdate. The query runs fine as long as there are records to fill the resultset i.e. records with EventDate between the startdate and finishdate. If I run the query with startdate and finishdates that result in no data meeting the criteria then I get the error message. 2 I changed the method to run the query without parameters and then applied a filter to the resultset. Everything is fine when the filter gives some records but when the filter results in no records I get the error Regards Bobby "Tim Young [Elevate Software]" <timyoung@elevatesoft.com> wrote in message news:745670A5-4BD8-433A-ADEE-1226F388CF5B@news.elevatesoft.com... > Bobby, > > << dmMain.qEvents.Active := False; > dmMain.qEvents.ParamByName('ADate1').AsDateTime := > StrToAnsiDate('2007-08-01'); > dmMain.qEvents.ParamByName('ADate2').AsDateTime := > StrToAnsiDate('2007-08-30'); > dmMain.qEvents.Active := True; > > When I try this it runs fine if there are records in the result set but > gives an exception error EConvertError - "'is not a valid date' >> > > Are you always using the above dates ? On what line is the EConvertError > occurring - on the ParamByName assignment or during the SQL execution ? > > Also, are you using 3.x or 4.x here ? > > -- > Tim Young > Elevate Software > www.elevatesoft.com > |
Mon, Jul 23 2007 5:07 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Bobby,
<< 1 standard query with 2 parameters - startdate and finishdate. The query runs fine as long as there are records to fill the resultset i.e. records with EventDate between the startdate and finishdate. If I run the query with startdate and finishdates that result in no data meeting the criteria then I get the error message. >> What happens when you run the same query in DBSYS ? If it works, then the issue is with the display of the blank date in the grid, etc. Do you have any OnGetText, etc. type of events attached to any of the query result TFields ? -- Tim Young Elevate Software www.elevatesoft.com |
Mon, Jul 23 2007 5:40 PM | Permanent Link |
"Bobby Gallagher" | Hi Tim
Yes - it works ok in dbsys. I thought that I have removed any connections to grids etc - but I will check again to be sure Regards Bobby "Tim Young [Elevate Software]" <timyoung@elevatesoft.com> wrote in message news:8390FB01-0150-4F16-A016-CAF459658ACA@news.elevatesoft.com... > Bobby, > > << 1 standard query with 2 parameters - startdate and finishdate. The > query runs fine as long as there are records to fill the resultset i.e. > records with EventDate between the startdate and finishdate. If I run the > query with startdate and finishdates that result in no data meeting the > criteria then I get the error message. >> > > What happens when you run the same query in DBSYS ? If it works, then the > issue is with the display of the blank date in the grid, etc. Do you have > any OnGetText, etc. type of events attached to any of the query result > TFields ? > > -- > Tim Young > Elevate Software > www.elevatesoft.com > |
Mon, Jul 23 2007 6:23 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Bobby,
<< Yes - it works ok in dbsys. >> Okay, then that means two things: a) It works okay with the stock DBISAM 3.30 b) It works okay with the stock Delphi TDBGrid Which leaves 3rd party components or an issue with the TField events like I said in the last post. Hopefully that will help narrow the search a bit. -- Tim Young Elevate Software www.elevatesoft.com |
Tue, Jul 24 2007 2:25 AM | Permanent Link |
"Bobby Gallagher" | Hi
I tried to track down the problem but gave up and used a table instead of a query and the filter worked fine with that. Still don't know the problem - it appears to be a problem in setting a filter on a live query result set Regards Bobby "Bobby Gallagher" <bobgal@computech.ie> wrote in message news:2EE966CF-1DB4-4643-A7AB-0FBA384B0452@news.elevatesoft.com... > Hi Tim > > Yes - it works ok in dbsys. > > I thought that I have removed any connections to grids etc - but I will > check again to be sure > > Regards > > Bobby > > "Tim Young [Elevate Software]" <timyoung@elevatesoft.com> wrote in message > news:8390FB01-0150-4F16-A016-CAF459658ACA@news.elevatesoft.com... >> Bobby, >> >> << 1 standard query with 2 parameters - startdate and finishdate. The >> query runs fine as long as there are records to fill the resultset i.e. >> records with EventDate between the startdate and finishdate. If I run >> the query with startdate and finishdates that result in no data meeting >> the criteria then I get the error message. >> >> >> What happens when you run the same query in DBSYS ? If it works, then >> the issue is with the display of the blank date in the grid, etc. Do you >> have any OnGetText, etc. type of events attached to any of the query >> result TFields ? >> >> -- >> Tim Young >> Elevate Software >> www.elevatesoft.com >> > > |
Tue, Jul 24 2007 3:38 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Bobby,
<< Still don't know the problem - it appears to be a problem in setting a filter on a live query result set >> You can try that also with DBSYS to see if it is something with your application or something to do with DBISAM. -- Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Sunday, May 19, 2024 at 08:46 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |