![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I'm trying to call a COM object using C# but having no luck getting values back for passed in ref objects. I've tried the same call using VB.NET and can get data back. How would I implement the following in C# This is the method I am calling, which populates ref paramters with results. Sub Check_Customer(ByVal Customer As String, Optional ByRef oParam1 As Object = Nothing, Optional ByRef oParam2 As Object = Nothing, Optional ByRef oParam3 As Object = Nothing, Optional ByRef oParam4 As Object = Nothing, Optional ByRef Return As Object = Nothing) Here is the VB.net code, which calls the function passing Dim customer = "123456", oParam1 = Nothing, oParam2 = Nothing, oParam3 = Nothing, oParam4 = Nothing, oReturnBlock = Nothing comObject.Check_Customer(customer, oParam1, oParam2, oParam3, oParam4, oReturnBlock) Dim myDA As System.Data.OleDb.OleDbDataAdapter = New System.Data.OleDb.OleDbDataAdapter Dim myDS1 As DataSet = New DataSet Dim myDS2 As DataSet = New DataSet myDA.Fill(myDS1, oParam1, "CustomerDetails") myDA.Fill(myDS2, oParam2, "CustomerNotes") Any help would be greatly appreciated. |
#3
| |||
| |||
|
|
string a=null,b=null; aaaa(ref a, ref b); u should use ref key world when passing parrameter to com function and assing null before passing it. "rocketfir... (AT) gmail (DOT) com" wrote: I'm trying to call a COM object using C# but having no luck getting values back for passed in ref objects. I've tried the same call using VB.NET and can get data back. How would I implement the following in C# This is the method I am calling, which populates ref paramters with results. Sub Check_Customer(ByVal Customer As String, Optional ByRef oParam1 As Object = Nothing, Optional ByRef oParam2 As Object = Nothing, Optional ByRef oParam3 As Object = Nothing, Optional ByRef oParam4 As Object = Nothing, Optional ByRef Return As Object = Nothing) Here is the VB.net code, which calls the function passing Dim customer = "123456", oParam1 = Nothing, oParam2 = Nothing, oParam3 = Nothing, oParam4 = Nothing, oReturnBlock = Nothing comObject.Check_Customer(customer, oParam1, oParam2, oParam3, oParam4, oReturnBlock) Dim myDA As System.Data.OleDb.OleDbDataAdapter = New System.Data.OleDb.OleDbDataAdapter Dim myDS1 As DataSet = New DataSet Dim myDS2 As DataSet = New DataSet myDA.Fill(myDS1, oParam1, "CustomerDetails") myDA.Fill(myDS2, oParam2, "CustomerNotes") Any help would be greatly appreciated. |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |