BDS2007 & TDateTime

Discussion of open issues, suggestions and bugs regarding usage of dbExpress drivers for Oracle in Delphi and C++Builder
Post Reply
Simonis Christophe
Posts: 3
Joined: Wed 04 Jul 2007 09:22

BDS2007 & TDateTime

Post by Simonis Christophe » Wed 04 Jul 2007 09:32

I've got an error when I execute a query with a TDateTime as parameter.

Here is a code sample

Code: Select all



#pragma hdrstop


#pragma argsused
int main(int argc, char* argv[])
	int r = 0;
	try {
		std::auto_ptr connector;
		connector.reset( new TSQLConnection(0) );

		std::cout LoginPrompt = false;
		connector->KeepConnection = true;

		connector->DriverName = "Oracle (Core Lab)";
		connector->LibraryName = "dbexpoda40.dll";
		connector->VendorLib = "oci.dll";
		connector->GetDriverFunc = "getSQLDriverORA";

		connector->Params->Values["BlobSize"] = "-1";
		connector->Params->Values["Database"] = "TNS_NAME";
		connector->Params->Values["User_Name"] = "USERNAME";
		connector->Params->Values["Password"] = "PASSWORD";

		connector->Open ();

		std::cout  query;
		query.reset( new TSQLQuery(0) );
		query->SQLConnection = connector.get();
		query->Active = false;

						   "              VALUES(:P_SESSION, :P_DEBUT) ";

		query->ParamByName("P_SESSION")->AsString = "093B3DD5-2DD6-408A-949C-4A74F7F43CD7";
		query->ParamByName("P_DEBUT")->AsDateTime = Now();

		std::cout StartTransaction(transaction);
		std::cout Rollback (transaction);
		std::cout CloseDataSets();
		connector->Close ();
        std::cout > end;

	return r;

and the output i've got is
connector created
connection opened
query created
error: Pas de valeur pour le paramÞtre 'P_DEBUT'

press [ENTER] to quit
The translated error message is No value for parameter 'P_DEBUT'


Simonis Christophe
Posts: 3
Joined: Wed 04 Jul 2007 09:22

Post by Simonis Christophe » Wed 04 Jul 2007 13:18

A workaround is to use SQLTimeStamp

Code: Select all

query->ParamByName("P_DEBUT")->AsSQLTimeStamp = DateTimeToSQLTimeStamp(Now());
The previous code was functional with C++ Builder 6...

However, with a SELECT I can still retrieve fields with the AsDateTime property :/

Post Reply