Problems when creating and using a ADODB.Recordset in a .NET assembly.

  • Thread starter Magnus Strandberg
  • Start date
M

Magnus Strandberg

Hello,

We are developing a WEB - application in .NET to be hosted on a Windows 2000
Server platform.
Internally we need to create and use an (Interop) ADODB.Recordset. We do
this with the following code:

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
using ADODB;
......
ADODB.Recordset oRS = new Recordset();
.....
oRS.Fields.Append(...)
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
(we have tried ADODB.RecorsetClass oRS = new RecordsetClass() as well -
works fine on the development machine, not on the server)

When we try to access the fields collection with the Append method, we get
the following error: "object reference not set to an instance of an object".

The code works just fine on the development machine (Windows XP Prof. SP2
with MDAC 2.8 SP1, Framework 1.1.4322, VS.NET 2003) but generates the above
error on the webserver (Windows 2000 SP4 with MDAC 2.8 RTM, Framework
1.1.4322).

We noted that the ADODB.dll PIA (7.0.3300.0) was installed in the GAC on the
development machine; this assembly was not registered in the GAC on the
server. We tried installing the assembly to the server GAC, but that did not
help (although it removed error messages stating that the assembly ADODB.dll
could not be found).

Any ideas why we can't create and use the Recordset on the server?

Thanks!

/Magnus Strandberg and Peter Stenhjelm
 
M

Mary Chipman [MSFT]

There are always going to be configuration issues and a performance
penalty when using Interop, particularly in a Web application. Is
there any particular reason why you feel you need to create and
consume an ADO recordset instead of using ADO.NET to directly connect
to the data source?

--Mary
 
G

Guest

I am using a reference to ADODB in an ASP.Net Web app - because I am using
CDO. I know interop and all that - but this is the only thing I could get to
work with our ADS.

The app is build on an XP Pro SP1 machine. I deployed to W2K Server and
stepped on this same issue; ADODB is not in the GAC on the W2K Server.

I have not tried to install ADODB into the GAC, but from the looks of it
this might not help?

Can anyone provide insight on: should ADODB install in the GAC on W2K Server
and work ok?
 
A

amitvk

I found the solution to my problem of being unable to register my .NET assembly using regasm.

The problem turned out to be that my DLL exposed an ADO recordset. This was not a problem on machines with Visual Studio.NET installed, because they have ADODB.DLL in the GAC. However, most user machines do not. So the solution was to copy ADODB.DLL from my local machine (C:\Program Files\Microsoft.NET\Primary Interop Assemblies\ADODB.DLL) to the target machine, and then install it to the GAC (gacutil -i ADODB.DLL).

I just copied the ADODB.dll to the Application's bin directory and it works too.

# posted by Steven Campbell @ 9:27 AM 0 comments


**********************************************************************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top