我有一個ASP.NET WCF Web服務,它從另一個服務獲取數據並通過事務將其保存在數據庫中。即所有來的數據都保存在數據庫(提交)中或者沒有(回滾)。VB6在.NET事務中的事務
我需要在數據庫中保存數據的過程中添加一個新階段,該階段將調用VB6 dll中的函數,該函數也使用事務來連接到同一個數據庫。那可能嗎?
這裏是用來調用VB6功能的.NET代碼:
object oMissing = System.Reflection.Missing.Value;
ADODB.Recordset rsKR = new ADODB.Recordset();
rsKR.Fields.Append("F1", ADODB.DataTypeEnum.adVarChar, 10, ADODB.FieldAttributeEnum.adFldFixed, null);
rsKR.Fields.Append("F2", ADODB.DataTypeEnum.adVarChar, 10, ADODB.FieldAttributeEnum.adFldFixed, null);
rsKR.Open(oMissing, oMissing, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockOptimistic, -1);
rsKR.AddNew(oMissing, oMissing);
rsKR.Fields["F1"].Value = someObject.Id;
rsKR.Fields["F2"].Value = someObject.Name;
rsKR.Update(oMissing, oMissing);
rsKR.MoveFirst();
VB6Project.ClassAPI objVBAPI = new VB6Project.ClassAPI();
objVBAPI.InsertIntoDBFunction(rsKR);
在此先感謝..
我試圖從.NET服務調用VB6的dll和順利,但我得到異常,當VB6獲取對數據庫中插入數據的階段。 – Lina 2012-07-24 14:09:09
因此,Vb6 DLL中的其他函數可以正常工作,並且在嘗試將數據插入到數據庫時會出現問題。 – JMK 2012-07-24 14:10:08
是的,這正是發生了什麼 – Lina 2012-07-24 14:11:51