Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Web Form and ADO.NeT Transaction

Reply
Thread Tools

Web Form and ADO.NeT Transaction

 
 
Lit
Guest
Posts: n/a
 
      08-08-2007
Hi,

using ADO.NET 2.0, VS.NET 2005, SQL2005
I need to execute several Stored Procedures under one transaction. Can I
use just one command/transaction or have to use multiple ( then commit or
rollback all )
How does it work with ADO.NET

Ado.Tran
SP1 Called
loop
SP2 Called
SP3 Called
loop
SP4 Called
loop
Sp5 Called
Etc... etc...

if any error
rollback transaction ( or all transactions )
else
committe Transaction ( or all Transactions )

Thanks for any help or other Ideas, needs also code links etc..


Lit


 
Reply With Quote
 
 
 
 
Aidy
Guest
Posts: n/a
 
      08-09-2007
Have a look here

http://msdn.microsoft.com/msdnmag/is...DataPoints/#S6

"Lit" <> wrote in message
news:...
> Hi,
>
> using ADO.NET 2.0, VS.NET 2005, SQL2005
> I need to execute several Stored Procedures under one transaction. Can I
> use just one command/transaction or have to use multiple ( then commit or
> rollback all )
> How does it work with ADO.NET
>
> Ado.Tran
> SP1 Called
> loop
> SP2 Called
> SP3 Called
> loop
> SP4 Called
> loop
> Sp5 Called
> Etc... etc...
>
> if any error
> rollback transaction ( or all transactions )
> else
> committe Transaction ( or all Transactions )
>
> Thanks for any help or other Ideas, needs also code links etc..
>
>
> Lit
>
>



 
Reply With Quote
 
 
 
 
Lit
Guest
Posts: n/a
 
      08-09-2007
Aidy,
I have one question, but first thanks for the great link.

in Figure 8, I see the following code
...
oCmd1.Transaction = oTran;
oCmd1.ExecuteNonQuery();

oCmd2.Transaction = oTran;
oCmd2.ExecuteNonQuery();
...

Question is: Can I reuse the same command object? by setting the
command.Text to a different SP and Different Parameters instead of creating
different command objects.
would that work and is it more efficient.

Thanks again,

Lit


"Aidy" <> wrote in message
news:...
> Have a look here
>
> http://msdn.microsoft.com/msdnmag/is...DataPoints/#S6
>
> "Lit" <> wrote in message
> news:...
>> Hi,
>>
>> using ADO.NET 2.0, VS.NET 2005, SQL2005
>> I need to execute several Stored Procedures under one transaction. Can I
>> use just one command/transaction or have to use multiple ( then commit or
>> rollback all )
>> How does it work with ADO.NET
>>
>> Ado.Tran
>> SP1 Called
>> loop
>> SP2 Called
>> SP3 Called
>> loop
>> SP4 Called
>> loop
>> Sp5 Called
>> Etc... etc...
>>
>> if any error
>> rollback transaction ( or all transactions )
>> else
>> committe Transaction ( or all Transactions )
>>
>> Thanks for any help or other Ideas, needs also code links etc..
>>
>>
>> Lit
>>
>>

>
>



 
Reply With Quote
 
Aidy
Guest
Posts: n/a
 
      08-10-2007
Don't see what you can't re-use the same command object but I don't think
you'll particularly gain anything.

"Lit" <> wrote in message
news:...
> Aidy,
> I have one question, but first thanks for the great link.
>
> in Figure 8, I see the following code
> ...
> oCmd1.Transaction = oTran;
> oCmd1.ExecuteNonQuery();
>
> oCmd2.Transaction = oTran;
> oCmd2.ExecuteNonQuery();
> ...
>
> Question is: Can I reuse the same command object? by setting the
> command.Text to a different SP and Different Parameters instead of
> creating different command objects.
> would that work and is it more efficient.
>
> Thanks again,
>
> Lit
>
>
> "Aidy" <> wrote in message
> news:...
>> Have a look here
>>
>> http://msdn.microsoft.com/msdnmag/is...DataPoints/#S6
>>
>> "Lit" <> wrote in message
>> news:...
>>> Hi,
>>>
>>> using ADO.NET 2.0, VS.NET 2005, SQL2005
>>> I need to execute several Stored Procedures under one transaction. Can
>>> I
>>> use just one command/transaction or have to use multiple ( then commit
>>> or rollback all )
>>> How does it work with ADO.NET
>>>
>>> Ado.Tran
>>> SP1 Called
>>> loop
>>> SP2 Called
>>> SP3 Called
>>> loop
>>> SP4 Called
>>> loop
>>> Sp5 Called
>>> Etc... etc...
>>>
>>> if any error
>>> rollback transaction ( or all transactions )
>>> else
>>> committe Transaction ( or all Transactions )
>>>
>>> Thanks for any help or other Ideas, needs also code links etc..
>>>
>>>
>>> Lit
>>>
>>>

>>
>>

>
>



 
Reply With Quote
 
Lit
Guest
Posts: n/a
 
      08-10-2007
Aidy,

By reusing the Command Object I can reduce the number of objects in the heap
memory?

Thanks for your help.

Lit

"Aidy" <> wrote in message
news:...
> Don't see what you can't re-use the same command object but I don't think
> you'll particularly gain anything.
>
> "Lit" <> wrote in message
> news:...
>> Aidy,
>> I have one question, but first thanks for the great link.
>>
>> in Figure 8, I see the following code
>> ...
>> oCmd1.Transaction = oTran;
>> oCmd1.ExecuteNonQuery();
>>
>> oCmd2.Transaction = oTran;
>> oCmd2.ExecuteNonQuery();
>> ...
>>
>> Question is: Can I reuse the same command object? by setting the
>> command.Text to a different SP and Different Parameters instead of
>> creating different command objects.
>> would that work and is it more efficient.
>>
>> Thanks again,
>>
>> Lit
>>
>>
>> "Aidy" <> wrote in message
>> news:...
>>> Have a look here
>>>
>>> http://msdn.microsoft.com/msdnmag/is...DataPoints/#S6
>>>
>>> "Lit" <> wrote in message
>>> news:...
>>>> Hi,
>>>>
>>>> using ADO.NET 2.0, VS.NET 2005, SQL2005
>>>> I need to execute several Stored Procedures under one transaction. Can
>>>> I
>>>> use just one command/transaction or have to use multiple ( then commit
>>>> or rollback all )
>>>> How does it work with ADO.NET
>>>>
>>>> Ado.Tran
>>>> SP1 Called
>>>> loop
>>>> SP2 Called
>>>> SP3 Called
>>>> loop
>>>> SP4 Called
>>>> loop
>>>> Sp5 Called
>>>> Etc... etc...
>>>>
>>>> if any error
>>>> rollback transaction ( or all transactions )
>>>> else
>>>> committe Transaction ( or all Transactions )
>>>>
>>>> Thanks for any help or other Ideas, needs also code links etc..
>>>>
>>>>
>>>> Lit
>>>>
>>>>
>>>
>>>

>>
>>

>
>



 
Reply With Quote
 
Aidy
Guest
Posts: n/a
 
      08-10-2007
Yeah, but you'll need to clear out the old parameters collection. Maybe you
are using slightly less space, but you need to execute more commands.
Swings and roundabouts really.

"Lit" <> wrote in message
news:...
> Aidy,
>
> By reusing the Command Object I can reduce the number of objects in the
> heap memory?
>
> Thanks for your help.
>
> Lit
>
> "Aidy" <> wrote in message
> news:...
>> Don't see what you can't re-use the same command object but I don't think
>> you'll particularly gain anything.
>>
>> "Lit" <> wrote in message
>> news:...
>>> Aidy,
>>> I have one question, but first thanks for the great link.
>>>
>>> in Figure 8, I see the following code
>>> ...
>>> oCmd1.Transaction = oTran;
>>> oCmd1.ExecuteNonQuery();
>>>
>>> oCmd2.Transaction = oTran;
>>> oCmd2.ExecuteNonQuery();
>>> ...
>>>
>>> Question is: Can I reuse the same command object? by setting the
>>> command.Text to a different SP and Different Parameters instead of
>>> creating different command objects.
>>> would that work and is it more efficient.
>>>
>>> Thanks again,
>>>
>>> Lit
>>>
>>>
>>> "Aidy" <> wrote in message
>>> news:...
>>>> Have a look here
>>>>
>>>> http://msdn.microsoft.com/msdnmag/is...DataPoints/#S6
>>>>
>>>> "Lit" <> wrote in message
>>>> news:...
>>>>> Hi,
>>>>>
>>>>> using ADO.NET 2.0, VS.NET 2005, SQL2005
>>>>> I need to execute several Stored Procedures under one transaction.
>>>>> Can I
>>>>> use just one command/transaction or have to use multiple ( then commit
>>>>> or rollback all )
>>>>> How does it work with ADO.NET
>>>>>
>>>>> Ado.Tran
>>>>> SP1 Called
>>>>> loop
>>>>> SP2 Called
>>>>> SP3 Called
>>>>> loop
>>>>> SP4 Called
>>>>> loop
>>>>> Sp5 Called
>>>>> Etc... etc...
>>>>>
>>>>> if any error
>>>>> rollback transaction ( or all transactions )
>>>>> else
>>>>> committe Transaction ( or all Transactions )
>>>>>
>>>>> Thanks for any help or other Ideas, needs also code links etc..
>>>>>
>>>>>
>>>>> Lit
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>

>>
>>

>
>
>



 
Reply With Quote
 
Lit
Guest
Posts: n/a
 
      08-10-2007
Aidy,

you got a good point there. It is going to be a balancing game.
I will have to think about my domain of contexts ( small infinity ) and see
what would be best.

Thank you for the enlightenment.

Lit


"Aidy" <> wrote in message
news:...
> Yeah, but you'll need to clear out the old parameters collection. Maybe
> you are using slightly less space, but you need to execute more commands.
> Swings and roundabouts really.
>
> "Lit" <> wrote in message
> news:...
>> Aidy,
>>
>> By reusing the Command Object I can reduce the number of objects in the
>> heap memory?
>>
>> Thanks for your help.
>>
>> Lit
>>
>> "Aidy" <> wrote in message
>> news:...
>>> Don't see what you can't re-use the same command object but I don't
>>> think you'll particularly gain anything.
>>>
>>> "Lit" <> wrote in message
>>> news:...
>>>> Aidy,
>>>> I have one question, but first thanks for the great link.
>>>>
>>>> in Figure 8, I see the following code
>>>> ...
>>>> oCmd1.Transaction = oTran;
>>>> oCmd1.ExecuteNonQuery();
>>>>
>>>> oCmd2.Transaction = oTran;
>>>> oCmd2.ExecuteNonQuery();
>>>> ...
>>>>
>>>> Question is: Can I reuse the same command object? by setting the
>>>> command.Text to a different SP and Different Parameters instead of
>>>> creating different command objects.
>>>> would that work and is it more efficient.
>>>>
>>>> Thanks again,
>>>>
>>>> Lit
>>>>
>>>>
>>>> "Aidy" <> wrote in message
>>>> news:...
>>>>> Have a look here
>>>>>
>>>>> http://msdn.microsoft.com/msdnmag/is...DataPoints/#S6
>>>>>
>>>>> "Lit" <> wrote in message
>>>>> news:...
>>>>>> Hi,
>>>>>>
>>>>>> using ADO.NET 2.0, VS.NET 2005, SQL2005
>>>>>> I need to execute several Stored Procedures under one transaction.
>>>>>> Can I
>>>>>> use just one command/transaction or have to use multiple ( then
>>>>>> commit or rollback all )
>>>>>> How does it work with ADO.NET
>>>>>>
>>>>>> Ado.Tran
>>>>>> SP1 Called
>>>>>> loop
>>>>>> SP2 Called
>>>>>> SP3 Called
>>>>>> loop
>>>>>> SP4 Called
>>>>>> loop
>>>>>> Sp5 Called
>>>>>> Etc... etc...
>>>>>>
>>>>>> if any error
>>>>>> rollback transaction ( or all transactions )
>>>>>> else
>>>>>> committe Transaction ( or all Transactions )
>>>>>>
>>>>>> Thanks for any help or other Ideas, needs also code links etc..
>>>>>>
>>>>>>
>>>>>> Lit
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>

>>
>>
>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Develop High Transaction Web Applications with Java MySQL & NetBeans G. Wizzzzz Java 0 11-26-2009 01:58 PM
Web transaction server in Python Philippe Martin Python 1 06-29-2006 06:58 AM
Win2003 SP1 error: "New transaction cannot enlist in the specified transaction coordinator" Vencz Istv?n ASP General 2 05-02-2005 05:53 AM
Transaction using data from multiple Web Forms ? =?Utf-8?B?U2FrZXQgTXVuZHJh?= ASP .Net 3 04-16-2005 09:22 PM
Question about transaction in Web service pc690403@yahoo.ca ASP .Net Web Services 0 11-05-2003 06:01 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57