Number is out of range error in Delphi XE6

I'm using an old Paradox database (BDE) along with an older Delphi 6 program I inherited, and it keeps giving me a Number is out of range error when I hit this statement:

POE_Data.OrdersTaxRate.AsFloat:= StrToFloat(Copy(TaxRateLabel.Caption, 1,1));

The TaxRateLabel.Caption equals 7%, and so the StrToFloat is passing just the 7 character. The TaxRate field is defined in the database as a BCD field with 2 decimal places. I don't see any minimum or maximum values set in the database, so why is this producing the number out of range error?
0
Michael
10/7/2014 5:24:36 PM
embarcadero.delphi.database 1294 articles. 0 followers. Follow

4 Replies
1404 Views

Similar Articles

[PageSpeed] 45

Yes, AString = '7', ADouble = 7, and I still get the error when this line executes: POE_Data.OrdersTaxRate.AsFloat := ADouble;  I also tried to substitute this in (POE_Data.OrdersTaxRate.AsFloat := 1.0;), but it also produces the same error.

> {quote:title=Ian Barker wrote:}{quote}
> Michael Hackney wrote:
> 
> > I'm using an old Paradox database (BDE) along with an older Delphi 6
> > program I inherited, and it keeps giving me a Number is out of range
> > error when I hit this statement:
> > 
> > POE_Data.OrdersTaxRate.AsFloat:=
> > StrToFloat(Copy(TaxRateLabel.Caption, 1,1));
> > 
> > The TaxRateLabel.Caption equals 7%, and so the StrToFloat is passing
> > just the 7 character. The TaxRate field is defined in the database as
> > a BCD field with 2 decimal places. I don't see any minimum or maximum
> > values set in the database, so why is this producing the number out
> > of range error?
> 
> Have you tried doing this to see what is actually happening?  With it
> separated out you can actually inspect the values and see if something
> daft is happening.  :)
> 
> {code}
> var
>   AString: string;
>   ADouble: double;
> begin
>   AString := Copy(TaxRateLabel.Caption, 1,1);
>   ADouble := StrToFloat(AString);
>   POE_Data.OrdersTaxRate.AsFloat := ADouble;
> 
>   // also try this - does it cause an error?
>   POE_Data.OrdersTaxRate.AsFloat := 1.0;
> 
> 
> {code}
> 
> 
> -- 
> IanB.
> http://about.me/IanBarker
0
Michael
10/7/2014 1:01:01 AM
Michael Hackney wrote:

> I'm using an old Paradox database (BDE) along with an older Delphi 6
> program I inherited, and it keeps giving me a Number is out of range
> error when I hit this statement:
> 
> POE_Data.OrdersTaxRate.AsFloat:=
> StrToFloat(Copy(TaxRateLabel.Caption, 1,1));
> 
> The TaxRateLabel.Caption equals 7%, and so the StrToFloat is passing
> just the 7 character. The TaxRate field is defined in the database as
> a BCD field with 2 decimal places. I don't see any minimum or maximum
> values set in the database, so why is this producing the number out
> of range error?

Have you tried doing this to see what is actually happening?  With it
separated out you can actually inspect the values and see if something
daft is happening.  :)

{code}
var
  AString: string;
  ADouble: double;
begin
  AString := Copy(TaxRateLabel.Caption, 1,1);
  ADouble := StrToFloat(AString);
  POE_Data.OrdersTaxRate.AsFloat := ADouble;

  // also try this - does it cause an error?
  POE_Data.OrdersTaxRate.AsFloat := 1.0;


{code}


-- 
IanB.
http://about.me/IanBarker
0
Ian
10/7/2014 7:56:46 PM
Michael Hackney wrote:

> Yes, AString = '7', ADouble = 7, and I still get the error when this
> line executes: POE_Data.OrdersTaxRate.AsFloat := ADouble;  I also
> tried to substitute this in (POE_Data.OrdersTaxRate.AsFloat := 1.0;),
> but it also produces the same error.
> 

Then it seems, to me, that the 'OrdersTaxRate' is not the field type
you thought it was - either at the field level or in the database (the
database schema not matching the persistent in-code field types).

I can't remember if you said you were using table/query components but
if you are...

If you remove and re-add that field the 'orders' table component by
double-clicking on the table and then selecting the dodgy field,
hitting delete.  Then save the fields list.  Save the changes to the
datamodule/form, CTRL+S, and then double click the component and select
"add fields" and select the missing field again - now does it work?

IanB.
http://about.me/IanBarker
0
Ian
10/8/2014 1:04:01 PM
I tried to remove and re-add the table components, but I still got the same result.  I then created a new table and a new procedure to post data to the table.  With the new procedure I was able to write to a Alpha, Currency, and Number field, but not a BCD field.

Now I changed the field type from BCD to Number and I was able to get that to work without error, but I'm just not sure that's what I want.  Time will tell.

Thanks for you assistance!

> {quote:title=Ian Barker wrote:}{quote}
> Michael Hackney wrote:
> 
> > Yes, AString = '7', ADouble = 7, and I still get the error when this
> > line executes: POE_Data.OrdersTaxRate.AsFloat := ADouble;  I also
> > tried to substitute this in (POE_Data.OrdersTaxRate.AsFloat := 1.0;),
> > but it also produces the same error.
> > 
> 
> Then it seems, to me, that the 'OrdersTaxRate' is not the field type
> you thought it was - either at the field level or in the database (the
> database schema not matching the persistent in-code field types).
> 
> I can't remember if you said you were using table/query components but
> if you are...
> 
> If you remove and re-add that field the 'orders' table component by
> double-clicking on the table and then selecting the dodgy field,
> hitting delete.  Then save the fields list.  Save the changes to the
> datamodule/form, CTRL+S, and then double click the component and select
> "add fields" and select the missing field again - now does it work?
> 
> IanB.
> http://about.me/IanBarker
0
Michael
10/8/2014 6:42:41 PM
Reply:

Similar Artilces:

Error on Delphi 6 but not on Delphi Xe for Ftp
I am Experimenting with get a file from our webside server via Ftp. I have 2 Machines 1 a laptop runing XP Delphi 6 Indy 10.5.8.0 An a machine runing Window 7 Delphi XE2 with Indy 10.5.8.0. I am using the Same Code on Both. procedure TFrmMain.ProcessItemDalySpecial; var PathDest : String; FileName : String; begin with FrmTb2 do begin if ReadIniBoolean(IniCfg,'FTP','UseFtpDaly') then begin Ftp.Host := ReadIniStr(IniCfg,'FTP','HostDaly'); Ftp.Port := ReadIniInt(IniCfg,'FTP'...

Delphi and Delphi for .Net
It seems that Delphi for .Net is slower than Delphi Win32 native applicaiton. I would like to know is it true all .Net application is slower than Win32 native applicaiton or it is Delphi for .Net only. Your information is great appreciated, Inung On 2011-06-21 18:20:17 +0100, Inung Huang said: > It seems that Delphi for .Net is slower than Delphi Win32 native applicaiton. > I would like to know is it true all .Net application is slower than > Win32 native applicaiton or it is Delphi for .Net only. If you are only running the code in the application once then, yes, yo...

Delphi XE6 phantom errors
Hi, Why does the IDE show units as undefined but when I build there are no errors? I have noticed the same thing occurs in Embarcadero webinars on the instructor's machine. Is this just an idiosyncrasy of Delphi that won't get fixed? Picture showing the issue: https://picasaweb.google.com/gwardell2/XE6?authkey=Gv1sRgCM79kKPXgPSPag#6037684914264499586 Gary Wardell wrote: > Hi, > > Why does the IDE show units as undefined but when I build there are > no errors? > > I have noticed the same thing occurs in Embarcadero webinars on the > instruc...

ArcGIS runtime errors after upgrading from Delphi 2007 to Delphi XE3
We have an application written in Delphi Pascal that accesses the ArcGIS 9.3 API through the COM interface. We recently upgraded from Delphi 2007 to Delphi XE3 and ever since we upgraded we have been getting runtime errors in the ArcGIS libraries that we were not getting before. Specifically the error is always "invalid floating point operation". The first one that was occurring was happening in the method "sg.SgCoordRefSetZ". I was able to eliminate this error by adding a call to FGeoSpatialReference.SetZDomain(-10000, 100000.0) even though there is nowhere that we&#...

MacinCloud deploy error Delphi XE6
I signed up with MacinCloud to create iPhone apps from my Windows/Delphi XE6 IDE. I followed JT's instructions to connect to the PAServer on MacinCloud. My iPhone code compiles and deploys but fails to kick off the IOS simulator. The message I get is "Unable to launch process on '208.52.189.12' using the parameters from the 'MacinCloud' profile. The following error was returned: 'Session ended'". I am connected to the latest PAServer for Delphi XE6 update 1. Anyone experience this issue and found a way to get past the error? Did you put in a pass...

RangeCheck error in Android Delphi XE6 update 1
We are getting a RangeCheckError in the Unit System.Variants in function _VarToInteger(const V: TVarData): Integer; The specific line is varLongWord: Result := V.VLongWord; The code that is calling this, is function TFDDAptTableAdapter.MatchRecordSet(const ATable: Variant; in Firdac.DApt.pas The specific line is oTab := TFDDatSTable(NativeUInt(ATable)); This function is called when a Local Dataset POST is executed. This occurs only in Android not win32 or IOS It does not always occur at the same point in program execution. Sometime on one table sometimes on another...

SEPA components for Delphi with Source Code (Delphi 5
Hi all, in the european union change next year the Bankingformat to the SEPA Format. All peoples and companies must change the bankingssoftware and the costumer data form acountnummers in the new IBAN and BIC numbers. See: http://www.arma-it.de/shop/artikelueber.php?wgruppeid=211&wgruppe_offen=211 Functions: - generate SEPA XML'S - Calc IBAN - BIC Database (DE,AT and CH) Questions: vertrieb@arma-it.de PS: Bankinssoftware for Develpoers (Germany only) http://www.arma-it.de/shop/artikelueber.php?wgruppeid=212&wgruppe_offen=212 El 26/10/13 21:38, A...

Delphi 2007 to Delphi 7
I've written a class in Delphi 2007 that is not supported in Delphi 7. What would be the best way to achive what I've done in Delphi 2007 in Delphi 7? Thanks, Tom type BondConstants = class { Bond Types } type BondType = record const TREASURY = 3; AGENCY = 0; CORP = 1; MUNI = 2; SBA = 5; MBS = 4; CMO = 6; end; { Day Count Methods } type DayCount = record const ACTUAL_360 = 2; ACTUAL_365 = 1; ACTUAL_ACTUAL = 1; d30_360 = 0; ...

Delphi 7 to Delphi XE2
Hi, Still using that old workhorse, Delphi7, but am going to the conference in London hosted by Embarcadero on Delphi XE2. Although I would like to "move with the times" and am keen to get the UNICODE and 64-bit support offered by the latest IDEs, I confess to being more than a little scared about all the UNICODE/String/AnsiString and 32/64 bit issues I'm probably going to fall over. Anyone recently upgraded from Delphi7 to one of the latest Delphi IDEs? Thanks, Alain On 03/02/2012 08:55, Alain Dekker wrote: > Still using that old workhorse, Delphi7, but...

Delphi XE6
Hi All I have some new projects planned and would like to know what is planned for XE6? I suppose I am being rather hopeful, because EMB never gives out any information of future projects. I desperately need to start a REST server project and would like to use Datasnap, but I am reluctant because of reported problems with Datasnap REST. I have heard that EMB is working on the DB RTL. Will this include fixes/improvements for Datasnap?? Godfrey Godfrey wrote: > I have some new projects planned and would like to know what is > planned for XE6? There has been ...

from delphi 6 to delphi 2010
Hi. It is possible, with component RX, dxforumlibrary, InfoPower3000Pro, StringAlignGrid. Accepts communication BDE. Thank by comments. excequiel arostica wrote: >Hi. > It is possible, with component RX, dxforumlibrary, >InfoPower3000Pro, StringAlignGrid. Accepts communication BDE. > >Thank by comments. Rx is dead and sources are taken over by jcl/jvcl. I dont know about the rest of the components and i have no experiences with bde over the last 9 years. excequiel arostica wrote: > Hi. > It is possible, with component RX, dxforumlibrary,...

Delphi XE / Delphi 2010
Hello! I noticed that Embarcadero® Delphi® 2010 Version is not on the list of products on Embarcadero page. Or is it still possible to buy it? Will RAD Studio XE compile programs written in Delphi 2010 without problems.? Thanks. Am 13.09.2010 09:04, schrieb Petra Nemec: > Will RAD Studio XE compile programs written in Delphi 2010 without problems.? As always you will probably have to recreate the projects as the import is still a bit -- special. Christian Hello! Does anybody know if it is still possible to get a Delphi2010 trial version (if yes where)? ...

Delphi 4 to Delphi 2009
Hello, Thanks to all who answered my previous question. That was a great help. And atlast our client agreed to upgrade our delphi version from 4 to Delphi 2009. *Sigh*. But before that, I need to give the estimation and cost regarding the migration to delphi 2009. Can anyone tell me is there any tool to migrate from delphi 4 to delphi 2009 or just I need to compile our Delphi 4 application in Delphi 2009. I have read from the delphi 2009 feature matrix that Delphi 1 through Delphi 2007 import is possible in delphi 2009. But i am not that sure considering the size of our application. ...

Delphi 4 to Delphi 2007
Hello, I will have to port a D4 application (with source) to D2007. what kind of problem could I face ? I will have to go to customer site tommorow to analyse its source code to quote the work, what should I care of to hestimate the porting time ? Thanks John Terry wrote: > Hello, > I will have to port a D4 application (with source) to D2007. > what kind of problem could I face ? > I will have to go to customer site tommorow to analyse its source code > to quote the work, what should I care of to hestimate the porting time ? You can probably do it by just changi...

Web resources about - Number is out of range error in Delphi XE6 - embarcadero.delphi.database

Number - Wikipedia, the free encyclopedia
A number is a mathematical object used to count , label, and measure . In mathematics , the definition of number has been extended over the years ...

Number - Wikipedia, the free encyclopedia
A number is a mathematical object used to count , label, and measure . In mathematics , the definition of number has been extended over the years ...

Women in tech: The numbers don't add up
... of female employees working at large technology companies is oddly consistent. But drilling down finds the problem is worse than the numbers ...

Black Friday Sales Numbers Are Useless And Wrong
... crowds worry retailers.” You should ignore these stories. On Sunday and Monday, the stories will become more definitive , with actual numbers. ...

Adele's '25' Becomes Biggest-Selling Number 1 Album As Records Topple
... no stopping Adele right now. Her new album "25" has notched up sales records around the world – and is just confirmed as the biggest Number ...

The Macy's Thanksgiving Day Parade by the Numbers - Fortune
Who is performing, how much do those floats cost, and how many people attend? We've got some answers.

UCHealth sets up telephone numbers for families of Colorado Springs victims
At 4:40 p.m. Friday, UCHealth Memorial Hospital issued a statement that the...

Watch: Thanksgiving By the Numbers
Discover the statistics behind America's favorite fall holiday.

Brett Favre's retired number unveiled by Packers
ESPN Brett Favre's retired number unveiled by Packers ESPN GREEN BAY, Wis. The Packers celebrated not one but two legendary quarterbacks from ...

Planned Parenthood Shooter: Gunman Wounds Four Police Officers, Unknown Number of Civilians in Colorado ...
Police are currently engaged in an active standoff with the gunman who injured at least four police officers and an unknown number of civilians ...

Resources last updated: 11/30/2015 7:44:19 AM