|
-
Oct 20th, 2001, 01:14 AM
#1
Thread Starter
Hyperactive Member
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....
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|