Home All Groups Group Topic Archive Search About
Author
9 Nov 2006 12:02 AM
saidin69@hotmail.com
Hi all.

I have created a Library in C#.  This library uses the SQLConnection
object to connect to a database.  Everything works fine in a .NET app.

If I compile the library using a strong name key, register it on the
computer using Regasm, I am then able to instantiate my class objects
from a legacy VB6 application.

The problem I get is when my internal objects attempt to Instantiate an
SQLConnection object.

I get ( Object Reference not set to an instance of an object )

when my class is created the following happens:

public SqlConnection oCon = new SqlConnection();

the class is created and I can do work.

when I then make this call:

public void ChangeConnection( string sqlconnection )
{
      if( this.oCon == null )
      {
    this.oCon= new SqlConnection();
    this.oCon.ConnectionString = sqlconnection;
      }
      else
                this.oCon.ConnectionString = sqlconnection;
}

Is there a problem using SQLConnection items when you register an item
and then use it from VB6??

AddThis Social Bookmark Button