precision in tFields

Hi

I am using the TADOQuery component to access a Visual Foxpro
database via ODBC.

The table that I access has a few float fields with different
decimal sizes.  While the Fields are 'floats', they are
not of type TFloatfield, but just TField (iirc).  How do
I get the field's number of decimal places?

When I look at the table in FoxPro, I see the number of
decimals.  I just can't seem to find where the information
of the decimal size is held.

Any clarifications appreciated

Edmund
0
Edmund
11/10/2008 9:06:09 AM
embarcadero.delphi.ado 597 articles. 1 followers. Follow

3 Replies
1393 Views

Similar Articles

[PageSpeed] 21

Hello Edmund

> While the Fields are 'floats', they are
> not of type TFloatfield, but just TField (iirc).  

You mean DataSet.Fields[AIndex] returns TField reference.
But you can always ask in debugger, using Evalute and Modify:
   ADOQuery1.Fields[i].ClassName
It will be, probably, TFloatField. If so, then you can cast:
   TFloatField(ADOQuery1.Fields[i]).Precision
If it will be of TBCDField / TFmtBCDField / etc, then just do
similar.

-- 
With best regards,
Dmitry Arefiev
AnyDAC Team

RemObjects Software
The Infrastructure Company
http://www.remobjects.com
0
Dmitry
11/10/2008 9:32:54 AM
Dmitry Arefiev wrote:
> You mean DataSet.Fields[AIndex] returns TField reference.
> But you can always ask in debugger, using Evalute and Modify:
>    ADOQuery1.Fields[i].ClassName
> It will be, probably, TFloatField. If so, then you can cast:
>    TFloatField(ADOQuery1.Fields[i]).Precision
> If it will be of TBCDField / TFmtBCDField / etc, then just do
> similar.

I didn't know one could do that.   Thanks Dmitry!

Edmund
0
Edmund
11/11/2008 1:01:15 AM
> {quote:title=Edmund Wong wrote:}{quote}
> Dmitry Arefiev wrote:
> > You mean DataSet.Fields[AIndex] returns TField reference.
> > But you can always ask in debugger, using Evalute and Modify:
> >    ADOQuery1.Fields[i].ClassName
> > It will be, probably, TFloatField. If so, then you can cast:
> >    TFloatField(ADOQuery1.Fields[i]).Precision
> > If it will be of TBCDField / TFmtBCDField / etc, then just do
> > similar.
> 
> I didn't know one could do that.   Thanks Dmitry!
> 
> Edmund

Does not seem to work when typecasting 
i.e. TFloatField(XDataSet.FieldByName('CostPrice')).Precision:= 4;

all data in a data aware control such as TDBEdit will only work to a precision of 2 decimals so that any calculations based on that field will not have the neccesary accurasy, although the raw data in the underlying database will have full precision of double etc. data.

i.e. XDataSet.FieldByName('CostPrice').AsFloat:= 55.123456; 

XDataSet.FieldByName('CostPrice').AsFloat * SomeNumber will not yield accurate answer to a higher precison than 2 because it seems that XDataSet.FieldByName('CostPrice').AsFloat in above calculation is used effectivly used as 55.12.

Any answers???
0
Johan
1/7/2009 8:04:01 AM
Reply:

Similar Artilces:

Convert Delphi 5 ADO App to Delphi 2007 ADO.NET
I have an appliction tha that is writen in Delphi 5 with ADOConnetion, ADOTable, and ADOQuery components. I need to upgrade to Delphi 2007 and use ADO.NET. I have the program building in with Delphi 2007. Is there anything I need to do to convert the ADO to ADO.NET? > I need to upgrade to Delphi 2007 and use ADO.NET. Why ? -- With best regards, Dmitry Arefiev AnyDAC (www.anydac.com) - Oracle, MS SQL Server, IBM DB2, MySQL, Firebird, Interbase, PostgreSQL, Sybase ASA, SQLite, MS Access, DBX, ODBC, InMem - universal high-speed native data access engine Reasons for ...

Delphi 6 to Delphi 2010 upgrade and ADO
We have an application written in Delphi 6 Professional that uses ADO to access databases servers that may be on other PCs in our network. We want to move to Delphi 2010 but can't decide if we need Professional or Enterprise. 2010 Pro has dbGO - will this give us the same functionality as the ADO components we use in Delphi 6 Pro? Thanks, Keith > 2010 Pro has dbGO - will this give us the same functionality as the > ADO components we use in Delphi 6 Pro? Yes. > {quote:title=Joachim Uersfeld wrote:}{quote} > > 2010 Pro has dbGO - will this give us the same func...

ASA7 ADO & Delphi ADO ?? Anyone is using it?
Any comments? Is it working? Any Problems? Thanks Hi, PR <noemail@no.com> schrieb in im Newsbeitrag: BoTThJaq$GA.89@forums.sybase.com... > Any comments? Is it working? Any Problems? I tried to connect to ASA7 via the new OLE DB - Provider and ADOExpress from Delphi 5.01. No chance. Only the error message 'Invalid Enum Value'. About the new provider I haven't heard anything good until now... Regards Frank Frank, I've experienced the same problem with the ASA 7 OLEDB Provider. I'm not sure if this is a bug in the AsaProvider or Delp...

Delphi 5 with ADO
Hi I'm having some problems adjusting a Delphi5/MSSQL database application, which i did not wrote (what's more: i'm not a Delphi expert either) so i thought maybe someone in this comunity will enlighten me. It' about an SQL command which is issued by this delphi5 application (the sql command was traced in SQL server with profiler), but which is nowhere to be found in the souce code. I've searched already all the components which i knew that could issue the SQL command (TADOQuery, TADOCommand) but with no l uck. Could anyone tell me other misterious places where i shou...

ASA7, ADO and Delphi
Hello! I've got a problem with accessing a database via ADO with Delphi 5. Everytime I set the ADOConnection active I get the error "Invalid enum value". I'm using Delphi 5 Enterprise and ASA7 with EBF #449. Is there anybody who ever get an ADOConnection to ASA7 with Delphi 5? Gruesse, Matthias I'm using C++ Builder 5 and get the same problem. I've asked this question before and no one seems to be able to respond... Matthias Hovestadt wrote: > Hello! > > I've got a problem with accessing a database via ADO > with Delp...

Delphi 2010, ADO and Datamodule
I installed Delphi 2010 on a Windows 7 x64. I have build a few applications using a datamodule and several Adodatasets, connecting to a SQL server. Until Delphi 2009 everything worked fine. When I open the project with 2010, I get an error, stating it can not find something, it probebly is not installed corectly. I tried reïnstalling without any succes. Projects with the sam AdO conecctions but no Datamodule run fine. Any sugestions? Regards, Kees Flipsen Kees Flipsen wrote: > I get an error, stating it can not find something, Do you really expect someone to be able...

ADO to ADO.NET
I'm an ASP programmer (VBScript) moving on to ASP.NET. So far I'm using:Microsoft Visual Studio 2003ASP.NET with C#I'm working on converting my code over to C#, from VBScript. Now, here is my code in VBScript (modified to better understand it, this is a edited ugly version):Function ExecuteSQL(sqlStatement)    ConnDriver = "Provider=SQLOLEDB; Data Source = " & dbIP & "; Initial Catalog = " & dbName & "; User Id = " & dbUser & "; Password=" & dbPassword     Set connTemp = Server.CreateObject("ADODB.Connection")    c...

Delphi, ADO, SQL Anywhere
This combination seem not to work together. I'm using D5 Enterprise, ASA 6.03 w/latest EBF On some tables it works. But most of the tables produce a message "An Error occured". As soon as data bound contols are used, the connection just gives errors. It seem to work fine, if I use client based cursors. But this option copys the server table to the local client. This is not acceptable for my large tables. It lasts several minutes on my pc. Are there plans to release a native OLE DB provider for ASA or at least to fix the ODBC driver so, that ADO can be used? I am very...

Delphi + Long Binary + ADO
How can I update a long binary field in an ASA6 database using Delphi + ADO (not ADOExpress)? I have the blob in a string, but when trying to update the field, I get an "invalid variant conversion" error. If I re-type the field to a long varchar, the update seems to work, but I concerned that this may be affected by code page selection. Do I have to worry about raw bytes written to a long varchar not coming back in exactly the same form? From the database side of things, a LONG VARCHAR and LONG BINARY should be treated exactly the same way. I might try posting this ...

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...

ADO not ADO.NET
Hi, I have to connect to a db using adodb (which i select from the references). I have to retrieve the car models from the database and bind them to a listbox. I am not sure how to proceed and I can't find any articles on ADO with .net and data binding. Here is the code that i tried but it only retrieves the car model for the specified id. If I delete the id it doesn't work. Also it writes the car model in the listbox vertically such as: B M W CODE: Imports System.Data Imports ADODB Imports System.Data.OleDb Public Class listboxADO Inherits System.Web.UI...

System.ADO with Delphi debugger.
By 2 or 3 days Delphi debugger D7 , D9 and DXE stops with a System ADO fatal error (irretrievable error), when the program sets to True the ADOConnection's connected property. If the executable program run outside IDE the error does'nt raise, but when it starts inside IDE with debug option the error raise and the program stops and don't open the desired connection. I tried to repair MDAC on my system (Win32 XP SP3), but the problem remain. What can I do to use the debugger into IDE? (I use Delphi since 11 years and this problem never raised). Studio Rubabno Chairman wrote: &...

ASA8 and Delphi ADO? Is it work?
Anybody test this configuration? As i can remember ASA7 don't work with Delphi via ADO. ---------------------------------- Oleg Kovalevsky Moscow, Russia I haven't tested ASA8 with Delphi, but I'm using ASA7 with Delphi 5 and ADOExpress. There are some glitches, but ASA support has been very helpful with addressing the problems. On Fri, 29 Mar 2002 17:01:05 +0300, "Oleg Kovalevsky" <okovalevsky@hotmail.com> wrote: >Anybody test this configuration? As i can remember ASA7 don't work with >Delphi via ADO. > > >----------...

ASA7, ADO, Delphi and Stores Procedures
Hello! I'm developing with Delphi 5 and access ASA7 with the ADO express components. So far, so good. Now I've got a weird problem calling stored procedures: As long as I call stored procedures that only have integer parameters everything is ok. But calling a stored procedure that has a string parameter leads me to a exception "unknown error". Here's how I call my stored procedure: with ADOCommand do begin Parameters[0].Value := iIntegerValue; Parameters[1].Value := sStringValue Execute; Result := Parameters[4].Value; end; If I use ODB...

Web resources about - precision in tFields - embarcadero.delphi.ado

Quadruple-precision floating-point format - Wikipedia, the free encyclopedia
... value 1 unless the exponent is stored with all zeros. Thus only 112 bits of the significand appear in the memory format, but the total precision ...

Precision Lighting (@precision_light) on Twitter
Sign in Sign up To bring you Twitter, we and our partners use cookies on our and other websites. Cookies help personalize Twitter content, tailor ...

PhotoXform+ Precision Image Shaping for Photo & Design (Premium Version) for iPad on the iTunes App Store ...
Get PhotoXform+ Precision Image Shaping for Photo & Design (Premium Version) on the App Store. See screenshots and ratings, and read customer ...

Dell Precision T5500 - a set on Flickr
... Sign Up Explore Recent Photos The Commons Getty Collection Galleries World Map App Garden Camera Finder Flickr Blog Upload Sign In Dell Precision ...

Accuracy vs Precision - YouTube
"Accuracy" and "precision" have different mathematical meanings. The difference between accurate and precise data is explained using kittens ...

Mohammed Bozorgi’s new artworks – a mix of calligraphy and scientific precision
Mohammed Bozorgi's art exhibition of calligraphy presented in a really contemporary way is a nice place to visit during Ramadan.

Review: Well-worn Australian Chamber Orchestra program has precision and polish
This program from the country's premier chamber orchestra was well worn in by the time the players reached Melbourne.

How precision medicine could revolutionise the way we treat mental illness
Modern medicine is on a trajectory towards... Modern medicine is on a trajectory towards precision medicine , or the ability choose a treatment ...

Stealth shopping: It takes military precision to work
On occasion Olivia’s* credit card statement has been ripped into tiny pieces and soaked in water before being thrown in the bin.

Shinbone connection pits passion against precision as old teammates square off in coaches' box
Shinbone connection pits passion against precision as old teammates square off in coaches' box

Resources last updated: 11/30/2015 3:25:45 AM