PDA

Click to See Complete Forum and Search --> : ADO, SQL server 7, VB6 connection problem


Graham Talbot
Aug 2nd, 1999, 06:20 PM
A plea for help!

The following code was placed into a UserDocument in an ActiveX Document Dll project.

We are using VB6(Visual Studio service pack 3), Microsoft ActiveX Data Objects 2.1, SQL Server 7 And IE5 on a Windows 95 machine.

The code runs fine in design mode but once the dll is complied, registered and run the connection does not work?!

We have tried unregistering and registering the dll but to no avail.

If we place the code in a standard exe and run it, it works?!

Option Explicit
Private cn1 As ADODB.Connection
Private rs1 As ADODB.Recordset

Private Sub Command1_Click()

cn1.Mode = adModeReadWrite
cn1.Open "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=test1;password=test1;Initial Catalog=DBtest;Data Source=server1;Connect Timeout=10"

MsgBox "Opened connection"

End Sub

Private Sub UserDocument_Initialize()
Set cn1 = New ADODB.Connection
Set rs1 = New ADODB.Recordset
End Sub

Private Sub UserDocument_Terminate()
Set rs1 = Nothing
Set cn1 = Nothing
End Sub


Any help you can give us would be greatly appreciated.

Cheers,

Graham Talbot.