Call a DLL LIB function in ASP.NET (Code Behind) or VB.NET (The same code is working fine in VB 6.0)

  • Thread starter Thread starter Peri
  • Start date Start date
P

Peri

Dear All,

In VB 6.0 declaring this function and calling this functions works smoothly.
But in VB.NET or ASP.NET (Code behind), I am getting an error in the line
"HResult = CreateReportOnRuntimeDS(Rs, svReportFile, svTTXFile, False,
True)" saying that, "Object reference not set to an instance of an object."
Can any one help me out to solve this problem.

Module Report
Declare Function CreateReportOnRuntimeDS Lib "p2smon.dll" (ByVal
lpUnk As Object, ByVal reportFile As String, ByVal fieldDefFile As String,
ByVal bOverWriteFile As Long, ByVal bLaunchDesigner As Long) As Long

---This is how I use this function in the procedure:
Public Sub pblsCreateReport(ByRef Rs As ADODB.Recordset, ByRef
svReportFile As String, ByRef svTTXFile As String)

Dim rsReportSet As New ADODB.Recordset()

rsReportSet = Rs

Dim HResult As Long

' Create the Report
HResult = CreateReportOnRuntimeDS(Rs, svReportFile, svTTXFile,
False, True)

End Sub

End Module

Thanks and Regards,

Peri
 
You might try changing the Long variables to Integer. Not sure if that
will solve your problem, but I know that the definitions changed
between VB6 and VB.NET.

-Phil
 
is it recursive function????? because you couldn't call sub routine in
itself.
I couldn't understand your code exactly. please send it clearer. just I
saw that u call a sub routine with itself???!!! . then how do u want ur
subroutine work when it is not complete yet.
 
No. It is not a recursive funtion

1. pblsCreateReport is a procedure which is called from the ASPX page.

2. CreateReportOnRuntimeDS is a function in the p2smon.dll and I am using
this function in the pblsCreateReport procedure

3. rs is a recorset defined in the ASPX page which contains the dataset (A
new instance for this has been created for this already).

Module Report
Declare Function CreateReportOnRuntimeDS Lib "p2smon.dll" (ByVal
lpUnk As Object, ByVal reportFile As String, ByVal fieldDefFile As String,
ByVal bOverWriteFile As Long, ByVal bLaunchDesigner As Long) As Long

---This is how I use this function in the procedure:
Public Sub pblsCreateReport(ByRef Rs As ADODB.Recordset, ByRef
svReportFile As String, ByRef svTTXFile As String)

Dim HResult As Long

' Create the Report
HResult = CreateReportOnRuntimeDS(Rs, svReportFile, svTTXFile,
False, True)

End Sub

End Module

Thanks and Regards,

Peri
 
Back
Top