BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Parameterised query

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (Desktop)
View previous topic :: View next topic  
Author Message
Alan
Guest





PostPosted: Tue Jan 13, 2004 3:06 pm    Post subject: Parameterised query Reply with quote




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





PostPosted: Tue Jan 13, 2004 3:44 pm    Post subject: Re: Parameterised query Reply with quote




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





PostPosted: Tue Jan 13, 2004 4:15 pm    Post subject: Re: Parameterised query Reply with quote



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





PostPosted: Tue Jan 13, 2004 10:09 pm    Post subject: Re: Parameterised query Reply with 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

Quote:
1.299 and < 1.301

--
Bill (TeamB)
(TeamB cannot respond to questions received via email)

Back to top
Alan
Guest





PostPosted: Wed Jan 14, 2004 8:41 am    Post subject: Re: Parameterised query Reply with quote


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





PostPosted: Wed Jan 14, 2004 12:46 pm    Post subject: Re: Parameterised query Reply with quote


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





PostPosted: Wed Jan 14, 2004 12:57 pm    Post subject: Re: Parameterised query Reply with 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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (Desktop) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.