Page 1 of 1
CBuilder 6.0 samples
Posted: Tue 03 May 2016 15:12
by jjeffman
Hello.
I could not find a "C++ Builder 6.0" full demo project, so I have built a new one based on the Delphi project OdacDemo.dpr.
I wonder if I have included all the needed files in the project. I am getting an error at linking time :
[Linker Fatal Error] Fatal: Unable to open file 'MSHTML.OBJ'
Is there any way of solving this error ? I would like to have a full demo project on C++ Builder 6.0.
Thank you very much.
Best regards.
Jayme Jeffman
Re: CBuilder 6.0 samples
Posted: Thu 05 May 2016 09:45
by MaximG
ODAC for C ++ Builder 6 includes an example demonstrating the work with this IDE: [ODAC for CBuilder 6 install folder]\Demos\Miscellaneous\CBuilder\. When you compile this example, be sure to specify paths to the folder [ODAC for CBuilder 6 install folder]\Include and [ODAC for CBuilder 6 install folder]\Lib in the project options: menu Project\Options\, tab "Directories\Conditionals", parameters "Include Path" and "Library Path".
Re: CBuilder 6.0 samples
Posted: Mon 09 May 2016 18:24
by jjeffman
Hello MaximG
Thank you for answering me.
Is the code you point me the same as the Delphi project ? It seems that the C++ Builder project do not include all tasks. I am interested on an example dealing with CLob data fields.
I am using a TOraSQL with a small unnamed procedure as follows:
Code: Select all
BEGIN
INSERT INTO S4MED_DMED
(MEDICAO, DATAHORA, NOMEARQ, CONTEUDO, EVENTO_ID)
VALUES
(:MEDICAO, TO_DATE(:DATAHORA,'YYYY-MM-DD HH24:MI:SS'), :NOMEARQ, EMPTY_CLOB(), :EVENTO_ID)
RETURNING
CONTEUDO
INTO
:CONTEUDO ;
EXCEPTION
WHEN DUP_VAL_ON_INDEX THEN
BEGIN
UPDATE S4MED_DMED
SET
DATAHORA = TO_DATE(:DATAHORA,'YYYY-MM-DD HH24:MI:SS'), CONTEUDO=EMPTY_CLOB(), EVENTO_ID = :EVENTO_ID
WHERE
MEDICAO = :MEDICAO AND NOMEARQ = :NOMEARQ
RETURNING
CONTEUDO
INTO
:CONTEUDO;
EXCEPTION
WHEN OTHERS THEN RAISE;
END;
WHEN OTHERS THEN RAISE;
END;
So I would like to pass data to the "CONTEUDO" field which is itself an Oracle CLob from a TStrings object .
I did not find any CLob reference on the C++ Builder Miscellaneous project.
Best regards.
Re: CBuilder 6.0 samples
Posted: Tue 10 May 2016 10:06
by MaximG
The Demo distributed with ODAC includes a Delphi sample using CLOB : [ODAC Install Folder]\Demos\ODACDemo\Clob. A C++Builder sample of filling in a table ODAC_Clob from this project will look as follows:
OraSession -> Connect();
OraQuery -> SQL -> Clear();
OraQuery -> SQL -> Add("INSERT INTO ODAC_CLOB (Code,Title,Value)");
OraQuery -> SQL -> Add(" VALUES (:Code, :Title, EMPTY_CLOB())");
OraQuery -> SQL -> Add(" RETURNING Value");
OraQuery -> SQL -> Add(" INTO :Value");
OraQuery -> ParamByName("Code") -> ParamType = ptInput;
OraQuery -> ParamByName("Code") -> DataType = ftInteger;
OraQuery -> ParamByName("Code") -> AsInteger = 100;
OraQuery -> ParamByName("Title") -> ParamType = ptInput;
OraQuery -> ParamByName("Title") -> DataType = ftString;
OraQuery -> ParamByName("Title") -> AsString = "My Title";
OraQuery -> ParamByName("Value") -> ParamType = ptInput;
OraQuery -> ParamByName("Value") -> DataType = ftOraClob;
OraQuery -> ParamByName("Value") -> AsString = "My Value" ;
OraQuery -> Execute();
Re: CBuilder 6.0 samples
Posted: Tue 10 May 2016 13:01
by jjeffman
Hello MaximG,
Thank you very much for answering me.
So as the code you have posted is using the parameter "AsString" property to assing the OraClob value I think my code might be working fine and I only could not see its value in the Oracle SQLDeveloper.
Best regards.
Jayme Jeffman
Re: CBuilder 6.0 samples
Posted: Fri 13 May 2016 11:27
by MaximG
We have checked displaying of field values filled in by the provided code sample in Oracle SQLDeveloper - and found no issues. Please clarify whether you managed to work with CLOB fields using ODAC for C ++ Builder 6.
Re: CBuilder 6.0 samples
Posted: Fri 13 May 2016 12:38
by jjeffman
Of course MaximG.
It was my fault.
The problem was that I haved set the OraClob parameter data type as ftWideString.
After I have checked your code and I realised that it should be ftOraClob.
So I have corrected the parameter data type and the application is now working fine.
Best regards.
Jayme Jeffman
Re: CBuilder 6.0 samples
Posted: Fri 13 May 2016 13:13
by MaximG
We are glad to see the problem resolved. Please don't hesitate to contact us with questions concerning ODAC usage.