Compile the code below as an ActiveX DLL named CNLib.CN
(You may need to change the connection string to match
your provider, etc)

Dim cn as ADODB.Connection

Private Sub Class_Initialize()
Set cn = New ADODB.Connection
cn.Open "Provider=SQLOLEDB.1;" & _
"Password=;Persist Security Info=True;" &_
"UserID=sa;Initial Catalog=YourDB;" &_
"Data Source=YOUR_SERVER"
End Sub

Private Sub Class_Terminate()
cn.Close
set cn = Nothing
End Sub

Public Function GetConnection() As ADODB.Connection
Set GetConnection = cn
End Function


Example usage in a VB form

Dim ProvideCN As CNLib.CN

Private Sub Form_Load()
Set ProvideCN = New CNLib.CN
End Sub

Hope this helps....