Search found 84 matches

by jjeffman
Mon 12 Sep 2022 21:41
Forum: Universal Data Access Components
Topic: Catch EDAError
Replies: 1
Views: 7589

Re: Catch EDAError

It is unbelievable, seventy visualizations and no any answer of what I guess is a bug of the component, TUniQuery->Execute() method is not throwing any exception and delegating this task to TUniConnection. I was hopping that somebody from the Devart team will answer to this question.
Devart support was better some years ago.

Kind regards.

Jayme Jeffman Filho
by jjeffman
Sat 03 Sep 2022 17:04
Forum: Universal Data Access Components
Topic: Catch EDAError
Replies: 1
Views: 7589

Catch EDAError

Hello,

I am using Unidac components version 9.2..1 for RAD Studio 10.4 (Delphi 10.4 and C++Builder 10.4 Update2), Windows 10 Build 16299 64x.

I am forcing an Oracle Error ORA-00001 to make the application to catch it and display a message in Portuguese, I am getting the original message from the server instead.

Code: Select all

	try
		{
			Query1->Execute();
			UniConn1->Commit();
		}
		catch(EDAError  *E)
		{
			if(E->ErrorCode == 00001 )
				Application->MessageBox(L"Manobra já cadastrada!",
										 Application->Title.c_str(),
										 MB_ICONERROR+MB_OK);
			else
				Application->MessageBox(E->Message.c_str(),
										 Application->Title.c_str(),
										 MB_ICONERROR+MB_OK);
			UniConn1->Rollback();
		}
		catch(Exception *E)
		{
			UniConn1->Rollback();
		}
What am I doing wrong?

Kind regards.

Jayme Jeffman Filho
by jjeffman
Wed 30 Jan 2019 20:38
Forum: Oracle Data Access Components
Topic: Direct Connection with Service Name
Replies: 5
Views: 4759

Re: Direct Connection with Service Name

Hello,

It is not an issue.

Double click TOraSession and the connection config dialog is shown. If you use it to fill in the values when you press Connect the Server property will contain a slash instead of "SN="

Thank you very much.
You can close this thread as solved.

Best regards.
by jjeffman
Wed 30 Jan 2019 14:53
Forum: Oracle Data Access Components
Topic: Direct Connection with Service Name
Replies: 5
Views: 4759

Re: Direct Connection with Service Name

Thank you very much for answering me.

Why TOraSession design connection dialog changes the Server property to "Host:1521/folder.site.com" if I use it to configure the connection ?
by jjeffman
Tue 29 Jan 2019 18:10
Forum: Oracle Data Access Components
Topic: Direct Connection with Service Name
Replies: 5
Views: 4759

Direct Connection with Service Name

Hello,

I am using ODAC 9.7.26 on C++Builder 6.0 Professional Edition.

Some time ago I have got an answer from ODAC support on how to deal with direct connections wich need to specify if it was using SID or Service Name.

The answer I have got told me to use SN=<name> when Service Name was necessary and
SID=<name> when SID was necessary.

Now the name is composed by a name in the same format of an internet address like "folder.site.com".

I realized that TOraSession works differently with names like that. How can I deal with service names like that ?

Thank you very much.

Thank you very much.

Jayme Jeffman Filho
by jjeffman
Tue 04 Dec 2018 12:59
Forum: Universal Data Access Components
Topic: Automatic Timestamp convesrion
Replies: 5
Views: 1329

Re: Automatic Timestamp convesrion

It seems it will work.

I have tried it on the SQL Server Studio and it works fine.

Thank you very much.

Best regards.

Jayme Jeffman
by jjeffman
Thu 29 Nov 2018 14:21
Forum: Universal Data Access Components
Topic: Automatic Timestamp convesrion
Replies: 5
Views: 1329

Re: Automatic Timestamp convesrion

Hello,

It is also important to keep in mind that datetime values in SQL Server have a precision of about 3 milliseconds, so CONVERT(DATETIME, '2018-29-11 13:22:33.444') will be converted to 2018-11-29 13:22:33.443 ( Ymd ).

Best regards.

Jayme Jeffman
by jjeffman
Thu 29 Nov 2018 13:25
Forum: Universal Data Access Components
Topic: Automatic Timestamp convesrion
Replies: 5
Views: 1329

Re: Automatic Timestamp convesrion

I have found that CONVERT(DATETIME, '2018-29-11 13:22:33.444') returns a valid SQL datetime value on SQL Server 2017. I do not know if this format is reliable to use on the CONVERT function without any style value.

I have made a question to a Microsoft forum ( https://social.msdn.microsoft.com/Forum ... ab907d73c6) which I am waiting for an answer.

I am using this format in the application although I am not sure it will not cause any problem on other windows regional settings.

Best regards.
by jjeffman
Wed 28 Nov 2018 20:21
Forum: Universal Data Access Components
Topic: Automatic Timestamp convesrion
Replies: 5
Views: 1329

Automatic Timestamp convesrion

Hello,

Again about the same topic but this time the question involves regional settings too.

I am coding SQL commands to SQL Server always avoiding to rely into the machine regional settings because it depends on the language the user has chosen to install the OS.

So when I use CONVERT I am always using the same format (121) which corresponds to yyyy-mm-dd hh:nn:ss.zzz like CONVERT( DATETIME,'2018-11-28 18:15:23.654', 121).

Is there a way of setting up the way UniDAC resolves the timestamp macro specifying a certain format to it? UniDAC is converting my strings to CONVERT( DATETIME,'2018-11-28 18:15:23.654'), which raises an exception.

I wouldn't like to check regional settings to create the timestamp string.

Thank you very much.
by jjeffman
Mon 19 Nov 2018 12:24
Forum: Universal Data Access Components
Topic: Automatic Timestamp convesrion
Replies: 11
Views: 1162

Re: Automatic Timestamp convesrion

Thank you very much for your time.

It is finally working.

Thank you so much.

Best regards.

Jayme Jeffman
by jjeffman
Fri 16 Nov 2018 14:06
Forum: Universal Data Access Components
Topic: Automatic Timestamp convesrion
Replies: 11
Views: 1162

Re: Automatic Timestamp convesrion

Hello Stellar.

I understand all your answers about macros created by the user.
As a matter of fact my problem is related to the predefined UniDAC macros.

I have changed my code using one of the options available for the tablename macro and the code still raises an exception at the EndUpdate method call.
It seems that the {timestamp } macro is not available in this version.
UnWork->SQL->BeginUpdate();
UnWork->SQL->Clear();

UnWork->SQL->Add("INSERT INTO HST2_OCORRENCIA \

(INICIO \
,ALARMEIN \
,TERMINO \
,DURACAO \
,ENVIOABERTURA \
,ENVIOFECHAMENTO \
,INTERVBUSCAINI \
,INTERVBUSCAFIM \
,BUSCAFALINF \
,BUSCAFALSUP \
,TRATAR \
,ENVIAREMAIL \
,MODULO_ID) \
VALUES \
({ timestamp '"+Ocorrencia.Inicio.FormatString("yyyy-mm-dd hh:nn:ss.zzz")+"'} \
,'"+Ocorrencia.AlarmeIN+"' \
,{ timestamp '"+Ocorrencia.Termino.FormatString("yyyy-mm-dd hh:nn:ss.zzz")+"'} \
,"+StringReplace(FloatToStrF(Ocorrencia.Duracao,ffFixed,10,2),",",".",TReplaceFlags()<<rfReplaceAll
)+" \
,{ timestamp '"+Ocorrencia.EnvioAbertura.FormatString("yyyy-mm-dd hh:nn:ss.zzz")+"'} \
,{ timestamp '"+Ocorrencia.EnvioFechamento.FormatString("yyyy-mm-dd hh:nn:ss.zzz")+"'} \
,{ timestamp '"+Ocorrencia.E3TimeStampIni.FormatString("yyyy-mm-dd hh:nn:ss.zzz")+"'} \
,{ timestamp '"+Ocorrencia.E3TimeStampFim.FormatString("yyyy-mm-dd hh:nn:ss.zzz")+"'} \
,"+StringReplace(FloatToStrF(Ocorrencia.E3LimFalInf,ffFixed,10,2),",",".",TReplaceFlags()<<rfReplaceAll
)+" \
,"+StringReplace(FloatToStrF(Ocorrencia.E3LimFalSup,ffFixed,10,2),",",".",TReplaceFlags()<<rfReplaceAll
)+" \
, '"+(Ocorrencia.Tratar ? "S" : "N") +"' \
,'"+(Ocorrencia.EnviarEmail ? "S" : "N") +"' \
,"+ IntToStr(Ocorrencia.ModuloId)+")");
}
UnWork->SQL->EndUpdate();
Please read carefully my post.
I can not afford an upgrade of UniDAC current version, and if the issue I am facing is a bug of the version I am using I would like a workaround to fix the issue.

Thank you very much.

Image

Jayme Jeffman
by jjeffman
Wed 14 Nov 2018 19:25
Forum: Universal Data Access Components
Topic: Automatic Timestamp convesrion
Replies: 11
Views: 1162

Re: Automatic Timestamp convesrion

I have tried the code bellow:

Code: Select all

		AddLogEntry("Numero de Macros: "+IntToStr(BDUNPVD->UDB->Macros->Count), evtInformation);
		for( int i=0; i<BDUNPVD->UDB->Macros->Count; ++i)
		{
			AddLogEntry("Macro[ "+IntToStr(i)+" ]= "+ BDUNPVD->UDB->Macros->Items[i]->Name, evtInformation);
    }
And the result was :

[ 2018-11-14 17:18:58.086 ] - Provider Name=SQL Server;Provider=TDS;Data Source=LOCALHOST\SQLEXPRESS;User ID=SA;Password=senha;Pooling=True;Connection LifeTime=120000;Max Pool Size=10;Validate Connection=True
[ 2018-11-14 17:18:58.143 ] - Numero de Macros: 0

Is there a way of checking if the predefined macros are present or available? It seems that there is some TUniConnection parameter not set.

Thank you very much.

Jayme Jeffman
by jjeffman
Wed 14 Nov 2018 15:39
Forum: Universal Data Access Components
Topic: Automatic Timestamp convesrion
Replies: 11
Views: 1162

Re: Automatic Timestamp convesrion

Do you think the problem might be I am enclosing the SQL definition in a Begin-EnUpdate block ?

Code: Select all

UniQuery->SQL->BeginUpdate();
UniQuery->SQL->Clear();
UniQuery->SQL->Add("INSERT INTO &tablename    \
	(INICIO             \ 
	,ALARMEIN          \ 
	,TERMINO           \ 
	,DURACAO            \ 
	,ENVIOABERTURA   \    
	,ENVIOFECHAMENTO   \     
	,INTERVBUSCAINI         \
	,INTERVBUSCAFIM      \
	,BUSCAFALINF         \
	,BUSCAFALSUP         
	,TRATAR              \
	,ENVIAREMAIL       \  
	,MODULO_ID)        \  
VALUES                   \
	({ TIMESTAMP '2018-10-16 06:32:30.163'}  \
	,''                                                   \
	,{ TIMESTAMP '1899-12-30 00:00:00.000'}  \
	,0.00 \
	,{ TIMESTAMP '1899-12-30 00:00:00.000'}   \
	,{ TIMESTAMP '1899-12-30 00:00:00.000'}  \
	,{ TIMESTAMP '2018-10-16 06:32:35.677'}   \
	,{ TIMESTAMP '1899-12-30 00:00:00.000'}   \
	,0.00 \
	,0.00\
	, 'S' \
	,'N' \
	,27)");
UniQuery->SQL->EndUpdate(); // I am getting exception at this point
PS.: I have commented the BeginUpdate and EndUpdate statements and it remains raising exception.

I have edited this post to add some information you might need.

I am using C++ Builder 10.2 and UniDAC 7.1.4 running on Windows 10 Professional.

I am connecting to an SQL Server Express version 14.0.1000.169 ( MSSQL 2017 ).

Thank you for any help.

Jayme Jeffman
by jjeffman
Tue 13 Nov 2018 15:44
Forum: Universal Data Access Components
Topic: Automatic Timestamp convesrion
Replies: 11
Views: 1162

Re: Automatic Timestamp convesrion

I have changed the connection provider to prNativeClient but nothing has changed. I am still getting macros errors.

The SQL before the EndUpdate() command loks like bellow:

Code: Select all

INSERT INTO &tablename    
	(INICIO              
	,ALARMEIN           
	,TERMINO            
	,DURACAO             
	,ENVIOABERTURA       
	,ENVIOFECHAMENTO     
	,INTERVBUSCAINI      
	,INTERVBUSCAFIM      
	,BUSCAFALINF         
	,BUSCAFALSUP         
	,TRATAR              
	,ENVIAREMAIL         
	,MODULO_ID)          
VALUES                   
	({ TIMESTAMP '2018-10-16 06:32:30.163'} 
	,''                                                   
	,{ TIMESTAMP '1899-12-30 00:00:00.000'} 
	,0.00 
	,{ TIMESTAMP '1899-12-30 00:00:00.000'}   
	,{ TIMESTAMP '1899-12-30 00:00:00.000'}  
	,{ TIMESTAMP '2018-10-16 06:32:35.677'}   
	,{ TIMESTAMP '1899-12-30 00:00:00.000'}   
	,0.00 
	,0.00
	, 'S' 
	,'N' 
	,27)
by jjeffman
Tue 13 Nov 2018 14:58
Forum: Universal Data Access Components
Topic: Automatic Timestamp convesrion
Replies: 11
Views: 1162

Re: Automatic Timestamp convesrion

Thank you very much for answering me.

I attempted to use
{ TIMESTAMP '2018-10-16 06:32:30.163'}
but it is raising "empty macro or function name" error.

I am connecting to a SQL Server using

Code: Select all

ProviderName = "SQL Server";
SpecificOptions->Values["Provider"] = "prDirect";
SpecificOptions->Values["Authentication"] = "auServer";
Connections to SQL Server using prDirect do not support this kind of macros ?

Thank you very much.

Jayme Jeffman