Hello,
I am using dbexpoda.dll 4.70.0.23 (trial version), cppbuilder 6, Oracle11g.
I have a TSQLQuery, a DataSetProvider and a ClientDataSet. TSQLQuery implements a simple query on a table. The table has a field, AFIELD, which is type "NUMBER(6)". The ClientDataSet has some persistent fields, one of them refer to AFIELD and is FMTBCD type.
When I open the ClientDataSet I got the error "EDatabaseError with message 'myClientDataSet: Type mismatch for field 'AFIELD', expecting: FMTBcdField actual: BCD'.". With no persistent fields in 'myClientDataSet' I get no error. What am I doing wrong? Thanks in advance.
Francesco
EDatabaseError, expecting: FMTBcdField actual: BCD
EDatabaseError, expecting: FMTBcdField actual: BCD
Last edited by Francesco on Tue 08 Feb 2011 16:03, edited 1 time in total.
I did it. I remove all the persistent fields (they were in the clientdataset). When I open the clientdataset it works.
I also disabled BCD feature and changed fields type in float and integer. With the feature disabled it works with persistent fields (float and integer instead of FMTBCD and BCD) too.
Francesco
I also disabled BCD feature and changed fields type in float and integer. With the feature disabled it works with persistent fields (float and integer instead of FMTBCD and BCD) too.
Francesco
Hello
If you want to use BCD fields you cannot replace a TFloatField persistent field by a TBCDField persistent field or a TFMTBCDField persistent field. Any field only displays data that is stored inside a DataSet. If format of stored data and your persistent field is not equal then you will get an error on attempt to open DataSet.
To define how database data will stored inside a DataSet you should use the following parameters (they are described in the ReadMe.html file that is located in the folder, where your dbExpress driver was installed):
EnableBCD - enable or disable BCD using
BCDPrecision - define format Oracle NUMBER in the DataSet: BCD or Float
I created a new table with a NUMBER(6) field. With default params (I specify Server, UserName and Password only) TBCDField was created for a field with NUMBER(6) data type:
Please try this code with a new TSQLConnection where any parameters wasn't changed from default values.
If you want to use BCD fields you cannot replace a TFloatField persistent field by a TBCDField persistent field or a TFMTBCDField persistent field. Any field only displays data that is stored inside a DataSet. If format of stored data and your persistent field is not equal then you will get an error on attempt to open DataSet.
To define how database data will stored inside a DataSet you should use the following parameters (they are described in the ReadMe.html file that is located in the folder, where your dbExpress driver was installed):
EnableBCD - enable or disable BCD using
BCDPrecision - define format Oracle NUMBER in the DataSet: BCD or Float
I created a new table with a NUMBER(6) field. With default params (I specify Server, UserName and Password only) TBCDField was created for a field with NUMBER(6) data type:
Code: Select all
begin
SQLConnection1.Open;
try
SQLConnection1.Execute('DROP TABLE test_table', nil);
except
end;
SQLConnection1.Execute('CREATE TABLE test_table ( ' +
' ID NUMBER, ' + #13 +
' NAME VARCHAR2(50) NOT NULL, ' + #13 +
' VALUE NUMBER(6), ' + #13 +
' CONSTRAINT PK_test_table PRIMARY KEY (ID))', nil);
SQLQuery1.SQL.Text := 'select * from test_table';
SQLQuery1.Open;
ClientDataSet1.Open;
ShowMessage(ClientDataSet1.FieldByname('VALUE').ClassName);
end;