Click here to Skip to main content
15,911,139 members
Home / Discussions / COM
   

COM

 
GeneralRe: I'm I looking at this correctly. Pin
BubbaGeeNH5-Oct-07 3:00
BubbaGeeNH5-Oct-07 3:00 
QuestionError code 269 Pin
Ohad Cabiri1-Oct-07 2:35
Ohad Cabiri1-Oct-07 2:35 
AnswerRe: Error code 269 Pin
JamesS[C1]2-Oct-07 10:54
JamesS[C1]2-Oct-07 10:54 
QuestionWindows Services Pin
Chandra.Anumakonda30-Sep-07 22:39
Chandra.Anumakonda30-Sep-07 22:39 
Questionsys files Pin
zon_cpp29-Sep-07 20:31
zon_cpp29-Sep-07 20:31 
AnswerRe: sys files [modified] Pin
Baltoro4-Oct-07 12:24
Baltoro4-Oct-07 12:24 
QuestionCOM Transaction Support Pin
SakthiSurya28-Sep-07 0:34
SakthiSurya28-Sep-07 0:34 
Questionthreading And Distributed transaction Pin
Fadi Abu-Mathkour25-Sep-07 7:58
Fadi Abu-Mathkour25-Sep-07 7:58 
Hi All:

I was trying to Used Distributed Transaction with Thread to allow many
Inserting operations into Different Databases in Different Server at the same
time

My Question is can we applying the Distributed Transaction and Threading
Together.

I try to apply it But the folowing Problem appeares through Open the first
Database Connection

An unhandled exception of type 'System.Runtime.InteropServices.COMException'
occurred in mscorlib.dll
Additional information: The component is configured to use synchronization
and this method call would cause a deadlock to occur.

' Some oF My The Code

Private strDBQA As String = "Data Source=QASRV; Initial Catalog=employee;
Password=sasa; User ID=sa"

Private strDBFA As String = "Data Source=FADI; Initial Catalog=Employee;
Password=sasa; User ID=sa" 'Enlist =false"

Private _Itransaction As System.EnterpriseServices.ITransaction

Private _boolQ As Boolean = False
Private _boolF As Boolean = False

Public ReadOnly Property PITransaction()
Get
Return _Itransaction
End Get
End Property


'The Main Function
Function TestThread(ByRef strError As String)
Try
_Itransaction = System.EnterpriseServices.ContextUtil.Transaction

Dim objThread As System.Threading.Thread
objThread = New System.Threading.Thread(AddressOf QServer)
objThread.Start()
objThread = New System.Threading.Thread(AddressOf Fserver)
objThread.Start()
If _boolF = True AndAlso _boolQ = True Then
ContextUtil.SetComplete()
strError = "Completed"
End If
Catch ex As Exception
ContextUtil.SetAbort()
strError = ex.Message
Catch ex As Exception

End Try


Private Sub QServer()
Try
Dim oConnectionQ As New SqlClient.SqlConnection
Dim cmdSql As New SqlClient.SqlCommand
oConnectionQ .ConnectionString = strDBQA

oConnectionQ .Open()
oConnectionQ .EnlistDistributedTransaction(PITransaction)
cmdSql.Connection = oConnectionQ
cmdSql.CommandText = "update Test set ID = ID + 10"
cmdSql.ExecuteNonQuery()
_boolQ = True
If _boolF = True AndAlso _boolQ = True Then
ContextUtil.SetComplete()
End If
Catch ex As Exception
ContextUtil.SetAbort()

End Try

End Sub


Private Sub Fserver()
Try
Dim oConnectionF As New SqlClient.SqlConnection
Dim cmdSql2 As New SqlClient.SqlCommand
oConnectionF .ConnectionString = strDBFA
'================
' in the strF oPen The Error Appear
oConnectionF .Open()
oConnectionF .EnlistDistributedTransaction(PITransaction)
cmdSql2.Connection = oConnectionF
cmdSql2.CommandText = "update Test set ID = ID + 10"
cmdSql2.ExecuteNonQuery()
_boolF = True
If _boolF = True AndAlso _boolQ = True Then
ContextUtil.SetComplete()
End If
Catch ex As Exception
ContextUtil.SetAbort()
End Try

End Sub










F.mathkour
AnswerRe: threading And Distributed transaction Pin
User 21559726-Sep-07 0:36
User 21559726-Sep-07 0:36 
QuestionIXMLDOMAttribute::put_value Pin
IWannaTalk24-Sep-07 3:36
IWannaTalk24-Sep-07 3:36 
AnswerRe: IXMLDOMAttribute::put_value Pin
Nathan Holt at EMOM24-Sep-07 10:56
Nathan Holt at EMOM24-Sep-07 10:56 
GeneralRe: IXMLDOMAttribute::put_value [modified] Pin
IWannaTalk24-Sep-07 11:54
IWannaTalk24-Sep-07 11:54 
GeneralRe: IXMLDOMAttribute::put_value Pin
IWannaTalk25-Sep-07 23:35
IWannaTalk25-Sep-07 23:35 
GeneralRe: IXMLDOMAttribute::put_value Pin
Nathan Holt at EMOM26-Sep-07 12:40
Nathan Holt at EMOM26-Sep-07 12:40 
GeneralRe: IXMLDOMAttribute::put_value Pin
IWannaTalk27-Sep-07 4:12
IWannaTalk27-Sep-07 4:12 
Questionsimple helloworld program for caling java from c++ ! help ! Pin
amitamit19820-Sep-07 22:53
amitamit19820-Sep-07 22:53 
QuestionRun-Time Check Failure #0 Pin
donguy7620-Sep-07 16:38
donguy7620-Sep-07 16:38 
AnswerRe: Run-Time Check Failure #0 Pin
Nathan Holt at EMOM21-Sep-07 9:02
Nathan Holt at EMOM21-Sep-07 9:02 
QuestionUsing Com dll in ASP.NET gives Security error Pin
Chetan Patel19-Sep-07 18:48
Chetan Patel19-Sep-07 18:48 
QuestionAdding buttons to Explorer toolbar (Groove 'Folder sync' style) Pin
__DanC__19-Sep-07 4:31
__DanC__19-Sep-07 4:31 
QuestionWhy we need COM Pin
Nandu_77b18-Sep-07 3:17
Nandu_77b18-Sep-07 3:17 
AnswerRe: Why we need COM Pin
Nathan Holt at EMOM18-Sep-07 7:43
Nathan Holt at EMOM18-Sep-07 7:43 
GeneralRe: Why we need COM Pin
Nandu_77b19-Sep-07 5:31
Nandu_77b19-Sep-07 5:31 
GeneralRe: Why we need COM Pin
Baltoro4-Oct-07 12:44
Baltoro4-Oct-07 12:44 
QuestionAvoid hang of the component manager with com+ console messages [modified] Pin
Vider18-Sep-07 1:51
Vider18-Sep-07 1:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.