傳client傳一個collection到MTS中com元件都會產生方法失敗
但用字串就沒問題
下列程式是com寫法
現在連msgbox那型都沒執行
請問如何解決
Public Function BatchSQL(SS As String, CL As Collection)
On Error GoTo www
MsgBox "test"
Dim obj As ObjectContext
Set obj = GetObjectContext()
Dim i As Integer
Dim ww
MsgBox SS
MsgBox CL.Count
For i = 1 To CL.Count
Set cc = CreateObject("Datadata.ADO")
MsgBox "test1"
MsgBox CL(i)
Call cc.Execute(SS, CL(i))
MsgBox "test2"
obj.SetComplete
Next
MsgBox "test3"
obj.SetComplete
Set obj = Nothing
MsgBox "test4"
Set cc = Nothing
Set obj = Nothing
Exit Function
www:
Err.Description = "指令執行失敗"
Err.Raise comError.ExecuteErr, "指令執行失敗"
Set cc = Nothing
If obj Is Nothing Then
Err.Raise NoContextError, "Transaction 失敗", "MTS 未啟動 ,無法取得 ObjectContext"
Else
obj.SetAbort
Err.Raise TransFail, "Transaction 失敗", Err.Description
Set obj = Nothing
End If
End Function