PDA

Click to See Complete Forum and Search --> : HELP - It is killing me!!!! HELP (MTS/COM+)


Namo
Jul 11th, 2000, 09:58 AM
(* Sorry about my english , I am from Israel *)

I admit it , I cant handle it anymotre , If you wont help i will die.

Please take a loot on this code:

Public Function DeleteCustomer(strCustomerID As String) As Boolean

some code against DB

end function


WOOHOO! its works fine (100% fine - even after i compile the client to exe and the Middle Tier to dll.

but This code isnt working for me!:


Public Function DeleteCustomer(strCustomerID As String) As Boolean

on error goto ErrHandler
Dim objContext As ObjectContext
Set objContext = GetObjectContext

some code against DB

objContext.SetComplete

exit function
ErrHandler:

objContext.SetAbort

end function


Thats it. just added some simple MTS code , i changed the MTStransactionMode
property to 2 (requeird trans) and i made a ref for the COM+ (i am working with win2k but its the same at NT 4 (right?)


After i recomplie both exe and dll and run it again , the SAME code not working for me!!
i got error msg: object variable do not set , but this is not the reason...

PLEASE any idea whats the porblem will help a lot,
I wait for your reply!!

Thanks!
Namo.

Ianpbaker
Jul 11th, 2000, 10:39 AM
Sorry If this is a stupid question, but have you included the reference for the project. If not go to Project,References then Find Microsoft Transaction Server type libary.

Ian

Clunietp
Jul 11th, 2000, 10:52 AM
shalom Namo

Your code looks good, did you register the DLL after you compiled it with the COM+ Manager?

The problem is that you're not retrieving the object context, possibly because the component is not properly configured for COM+

Tom

Namo
Jul 11th, 2000, 01:23 PM
Ianpbaker - Yes , I made a ref . not to Microsoft Transaction Server type libary. Bcoz i use win2k , and its called now COM+ Service (this is not the problem for sure)

Clunietp - yes , i registerd it (new applicainon and added the component etc..)

I think i found that problem . i noticed (after 100000 hours) that the object.SetComple working. BUT after object.SetComple or object.SetAbort my Calss Terminate and Initailize ( 2 events . destryo and build) events are fired ,this is the resaon for the problem.

I have 2 questions for you :)

1. You know why this 2 events fired? can i change it somehow? (is it only with COM+ maybe?)

2. You knoy how i can debug my component without compile it first? everytime i want to check something with MTS i have to compile it first and run the exe file that call the dll, can u make MTS enable when i debug? (i got win2k pro.)

Toda Clunietp !!!

Namo.

Namo
Jul 12th, 2000, 12:47 PM
Clunietp , About 1 : yeah , you right and i will use the IObjectControl_Activate and IObjectControl_Deactivate methods from now, BUT my class will still recreate - i will still loose connecting and reconnect , right?
i mean . if i declare objConnection in my General Declaration , after .SetComplte/.SetAbort this connection object will go down (like all the class , even i dont put any code on Class_Initialize and Class_Terminate events, Bcoz it will recreated , right?)
hmm , so whtas it the diff between IObjectControl_Activate / IObjectControl_Deactivate to Class_Initialize and Class_Terminate

(Sorry ,i am kinda new with this )

about 2. VB IDE=? is it the regular vb app. ? or what is it? Bcoz i already tryed to use it in the regualr vb app.

I hope you understand my english , Thanks alot!

Namo.

Clunietp
Jul 13th, 2000, 01:35 AM
Namo:

1. Do not have a private connection object declared at module level. COM+ does connection pooling for you, so you don't want to implement any startup/shutdown code to connect/disconnect from your DB. I guess you could without any problems, but then your functions are less cohesive.


2. the VB IDE is the editor, where you type in your code. You can get the object context when you debug it (F5)