Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.

Unable to use ADODB Recordset in .NET C#

1 view
Skip to first unread message


Oct 18, 2002, 8:39:29 AM10/18/02
Well, it changed the error message, which is now:

"An unhandled exception of type 'System.NullReferenceException' occurred in

Additional information: Object reference not set to an instance of an

Other than that, my problem remains the same as stated below.



Can you create a new instance of recordset and then populate it by method


private ADODB.Recordset rsFBillData = new ADODB.Recordset();
rsFBillData = oFBE.GetFBillData("482-389548-9");

If this does not work, then post your question again in
<microsoft.public.dotnet.framework.interop> thread.

Hope this helps!
Bharat Patel
Microsoft, Visual Basic .NET

This posting is provided "AS IS" with no warranties, and confers no rights.
Please reply to newsgroups only. Thanks.


A team at work has developed a VB 6.0 COM+ object that has a few rather
complex methods that I could use for my current project. Rather than
reinvent the wheel, I want to make a few method calls to their object from
.NET / C#. So I registered their object on my box with no problems. I tried
a test from VB 6.0, making a reference, then calling a method that I'm
interested in. It all worked great.

Then in .NET, I make a reference to this object too. I also reference ADODB
v2.7. Intellisense shows the properties, methods, ect... as I would expect.
Here's a code snippet that I wrote in C#:

fbeBusServerDotNet.clsFBEApplication oFBE = new
ADODB.Recordset rsFBillData = oFBE.GetFBillData("482-389548-9");
// do stuff

Now the problem. I can't access rsFBillData, the ADODB.Recordset. In
debugging, oFBE is instantiated and the method call succeeds. At this point
everything seems fine. A "Quick Watch" shows that rsFBillData contains the
values that I would expect, like RecordCount=1, EOF=false, ect... However,
the code fails at rsFBillData.EOF, complaining that "An unhandled exception
of type 'System.ExecutionEngineException' occurred in ...". In the
"Immediate Window", I learn the following:

error: 'rsFBillData.EOF' does not exist
[ADODB.RecordsetClass]: {ADODB.RecordsetClass}
error: 'rsFBillData.RecordCount' does not exist

The errors contradict what "Quick Watch" is showing me. According to "Quick
Watch", the properties EOF and RecordCount have values of 'false' and '1'.

How can I get this working?


Oct 18, 2002, 10:14:50 AM10/18/02
I've isolated the problem even more. Our project in .NET requires a key
(.snk) file, so we used TBLIMP to generate a DLL for us to reference. The
command looks like this:

tlbimp "C:\PROJECTS\Freight Billing Entry\Working
Version\Release\Server\!fbeBusServer.dll" /out:"C:\PROJECTS\Freight Billing
Entry\Working Version\Release\Server\fbeBusServerDotNet.dll"

Then we reference fbeBusServerDotNet.dll in .NET, and get the below results.
Note that !fbeBusServer.dll is the VB 6.0 COM+ object.

However, I created a test project that doesn't use a key, so I simply
referenced the VB 6.0 COM+ object directly. It works!

Then I used the TLBIMP command without referencing the keyfile (the test
project is not signed). The generated DLL fails just as listed below.

So how can I get TLBIMP to work so I can use this DLL signed?

"Dave" <> wrote in message

Bharat Patel [MS]

Oct 18, 2002, 12:41:17 PM10/18/02
Hi Dave,

For C# projects, this is easy to fix.

In your project where you have unsigned COM-DLL, go to Project Properteis
Open Common Properties -> General section.
In this section, there is a field called "Wrapper Assembly Key File".
Provide the Key file name here and your InterOP DLL will be signed by VS

0 new messages