| View previous topic :: View next topic |
| Author |
Message |
Alan Guest
|
Posted: Tue Jan 13, 2004 3:06 pm Post subject: Parameterised query |
|
|
I use parameterised query as follows
query1.ParamByName('StartVal').AsFloat := NewValue;
The actual data type for StartVal in the database is Number(4,2).
I declared NewValue as REAL type in the Delphi program.
But it doesn't retrieve any record from the table eventhough matching data exist in the table.
I am using Dbase.
What am I doing wrong?
|
|
| Back to top |
|
 |
Alan Guest
|
Posted: Tue Jan 13, 2004 3:44 pm Post subject: Re: Parameterised query |
|
|
Didn't work.
"Ignacio Vazquez" <ivazquezATorioncommunications.com> wrote:
| Quote: | Alan wrote:
What am I doing wrong?
Try using Currency and .AsCurrency instead of Real and .AsFloat.
--
Cheers,
Ignacio
Help improve Delphi: http://qc.borland.com/
|
|
|
| Back to top |
|
 |
Ignacio Vazquez Guest
|
Posted: Tue Jan 13, 2004 4:15 pm Post subject: Re: Parameterised query |
|
|
Alan wrote:
| Quote: | What am I doing wrong?
|
Try using Currency and .AsCurrency instead of Real and .AsFloat.
--
Cheers,
Ignacio
Help improve Delphi: http://qc.borland.com/
|
|
| Back to top |
|
 |
Bill Todd (TeamB) Guest
|
Posted: Tue Jan 13, 2004 10:09 pm Post subject: Re: Parameterised query |
|
|
Trying to locate a number using a floating point value is not likely
to work because floating point notation cannot represent most decimal
fractions exactly. Try using a range. For example, if you are looking
for 1.23 try
--
Bill (TeamB)
(TeamB cannot respond to questions received via email)
|
|
| Back to top |
|
 |
Alan Guest
|
Posted: Wed Jan 14, 2004 8:41 am Post subject: Re: Parameterised query |
|
|
I used range but didn't work.
I converted string value to float (StrToFloat) and then pass to parameter field as Float (ParamByName('FldNm').AsFloat).
I use number field with two decimal places to store time (Strat time and End time) since time field not available in Dbase iv. I need an hour and half an hour time slots only (for example, 7am store as 7.00, 3.30pm store as 15.50 in the table).
I have a function to check whether the given start and End time slot is available to add a new record. To do that I use the following query.
((StartTime < :ApptEnd AND :ApptEnd < EndTime) OR
(StartTime = :ApptStart AND :ApptEnd = EndTime) OR
(StartTime < :ApptStart AND :ApptStar < Endtime) OR
(:ApptStart < StartTime AND :ApptEnd > EndTime) OR
(StartTime = :ApptStar AND EndTime < :ApptEnd) OR
(:ApptStart < StartTime AND :ApptEnd = EndTime))
"Bill Todd (TeamB)"
| Quote: | Trying to locate a number using a floating point value is not likely
to work because floating point notation cannot represent most decimal
fractions exactly. Try using a range. For example, if you are looking
for 1.23 try
1.299 and < 1.301
--
Bill (TeamB)
(TeamB cannot respond to questions received via email)
|
|
|
| Back to top |
|
 |
Alan Guest
|
Posted: Wed Jan 14, 2004 12:46 pm Post subject: Re: Parameterised query |
|
|
Thanks any way Bill.
Regards,
Alan
"Bill Todd (TeamB)" <no (AT) no (DOT) com> wrote:
| Quote: | Other than floating point imprecision I have no idea. Perhaps someone
with more dBase table experience will be able to help.
--
Bill (TeamB)
(TeamB cannot respond to questions received via email)
|
|
|
| Back to top |
|
 |
Bill Todd (TeamB) Guest
|
Posted: Wed Jan 14, 2004 12:57 pm Post subject: Re: Parameterised query |
|
|
Other than floating point imprecision I have no idea. Perhaps someone
with more dBase table experience will be able to help.
--
Bill (TeamB)
(TeamB cannot respond to questions received via email)
|
|
| Back to top |
|
 |
|