Board index » delphi » Nested Transactions With Delphi 5 and SQL Server 2000

Nested Transactions With Delphi 5 and SQL Server 2000

Hello!

I am having big problems implementing nested transactions in my delphi app
at the moment.  I know that this is not an easy topic and the documentation
suggests that this is not possible using Delphi components so I am now
trying to use the example code given at

http://support.microsoft.com/default.aspx?scid=kb;en-us;Q238163

This article gives VB code and I am trying to translate it into Delphi.  I
have imported and am using the ADO type library directly, but I am getting a
compile error on this line

VAR Test:_Connection;
begin
  Test:=CoConnection.Create;
  Test.Open(<My Connection String>,'','',0);
  Test.CursorLocation:=adUseClient;

  Test.Execute('BEGIN TRANSACTION OuterMost',adAffectAll,1);

The type library states that the last parameter is options and should be
integer, but I get the compiler error "Types of actual and formal parameter
must be identical"

Does anyone know what is wrong, or has anyone managed to get nested
transactions to work with SQL Server and ADO 2.6?

Cheers

Mike

 

Re:Nested Transactions With Delphi 5 and SQL Server 2000


"Mike Evans" <mikeevans...@hotmail.com> wrote in news:3cd66229_2@dnews:

Quote
> VAR Test:_Connection;
> begin
>   Test:=CoConnection.Create;
>   Test.Open(<My Connection String>,'','',0);
>   Test.CursorLocation:=adUseClient;

>   Test.Execute('BEGIN TRANSACTION OuterMost',adAffectAll,1);

You may want to look at:

http://msdn.microsoft.com/library/default.asp?url=/library/en-
us/ado270/htm/mdmthbegintrans.asp

Thanks,

Al

Re:Nested Transactions With Delphi 5 and SQL Server 2000


Quote
>Test.Execute('BEGIN TRANSACTION OuterMost',adAffectAll,1);

>The type library states that the last parameter is options and should be
>integer, but I get the compiler error "Types of actual and formal parameter
>must be identical"

My type library says the parameters are
(ConectionString:WideString;Username:Widestring;Password:widestring;Options:integer)
Looks to me like you are two widestrings short and AdAffectAll is an enumerated
type for Resync.

--
Brian Bushay (TeamB)
Bbus...@NMPLS.com

Re:Nested Transactions With Delphi 5 and SQL Server 2000


Hi Brian!

This is really starting to get annoying now, all I want to do is nest
transactions! grrr!  Have you ever managed to do it?

The modified code below STILL will not compile

Test.Execute('BEGIN TRANSACTION OuterMost','','',adAffectAll,0);

Where did you import your type library from, what version is it?  It still
complains with the same error message, now on the third parameter

Cheers

Mike

"Brian Bushay TeamB" <BBus...@Nmpls.com> wrote in message
news:pqieduk39rm97mj8ptuv8vqv944hpdum2l@4ax.com...

Quote

> >Test.Execute('BEGIN TRANSACTION OuterMost',adAffectAll,1);

> >The type library states that the last parameter is options and should be
> >integer, but I get the compiler error "Types of actual and formal
parameter
> >must be identical"
> My type library says the parameters are

(ConectionString:WideString;Username:Widestring;Password:widestring;Options:
integer)
Quote
> Looks to me like you are two widestrings short and AdAffectAll is an
enumerated
> type for Resync.

> --
> Brian Bushay (TeamB)
> Bbus...@NMPLS.com

Re:Nested Transactions With Delphi 5 and SQL Server 2000


Quote
>This is really starting to get annoying now, all I want to do is nest
>transactions! grrr!  Have you ever managed to do it?

No. I believe that with SQL server you can only nest transactions inside SQL
server

Quote
>The modified code below STILL will not compile

>Test.Execute('BEGIN TRANSACTION OuterMost','','',adAffectAll,0);

>Where did you import your type library from, what version is it?  It still
>complains with the same error message, now on the third parameter

I believe I imported the 2.6 type library
--
Brian Bushay (TeamB)
Bbus...@NMPLS.com

Other Threads