0
Answer

passing parameters from c# to vb com+ .dll

batusai_hrd

batusai_hrd

21y
1.9k
1
good day, i have a big problem, we have a com+ application written i n vb6, we pass the paramater in each method of the components through propbag, here the example code of vb 6 component ---------------------------------------------------------------------------------------------- Public Sub Insert(ByVal Param As String) Dim Cn As ADODB.Connection Dim SQL As String Dim PropBag As New PropertyBag Dim CustomerID As String Dim CustomerName As String PropBag.Contents = CByteArray(Param) 'function the return byte array On Error GoTo ErrorHandler With PropBag CustomerID = .ReadProperty("CustomerID") CustomerName = .ReadProperty("CustomerName") SQL = SQL & "INSERT INTO Customers (CustomerID,CustomerName) " & vbNewLine SQL = SQL & "VALUES ('" & CustomerID & "','" & CustomerName & "')" End With Set Cn = GetConnection() Call Cn.Execute(SQL) Set Cn = Nothing Call mObjectContext.SetComplete Exit Sub ErrorHandler: Set Cn = Nothing Call mObjectContext.SetAbort Call Err.Raise(Err.Number, Err.Source, Err.Description, Err.HelpFile, Err.HelpContext) End Sub ---------------------------------------------------------------------------------------------- and we access this component in client with this code: ----------------------------------------------------------------------------------------------- Dim Cust As COMPlusTest.Customers Dim PropBag As New PropertyBag Set Cust = CreateObject("COMPlusTest.Customers") With PropBag Call .WriteProperty("CustomerID", txtID.Text) Call .WriteProperty("CustomerName", txtName.Text) End With Call Cust.Insert(PropBag.Contents) MsgBox "Successfuly saved ." ----------------------------------------------------------------------------------------------- my problem is since there is no propertybag in .NET, how can i pass parameter in the INSERT method of the particular component? does .NET have a counter part of propertybag? pls help me, i have a very big problem if i didnt get this. pllllssss, if possble you can email for the solution, [email protected], tnx

Next Recommended Forum