Hi All
I am using vb6 and sql server 2005. I’m trying to connect to a database obviously from vb6. I got some code from the net which is
Now I tried running it but get the messagevb Code:
'Declaring your database Public MyDatabase As ADODB.Connection 'Tables into your database Public MyTable1 As ADODB.Recordset Private Sub Form_Load() 'Set your variables to nothing (just for stability) Set MyDatabase = Nothing Set MyTable1 = Nothing 'Connecting to your DB Set MyDatabase = New ADODB.Connection Set MyTable1 = New ADODB.Recordset 'Here's where you're to set all your database options ConnectionString = "Provider=SQLOLEDB.1" _ & ";User ID=YOUR-E50BC0DF75\nick" _ & ";Password=" _ & ";Initial Catalog=vb6sql" _ & ";Data Source=xxx.x.x.x\YOUR-E50BC0DF75\SQLEXPRESS" 'If your database is in another computer in the local network you can replace 127.0.0.1 with it's ip adress MyDatabase.Open ConnectionString MyTable1.CursorLocation = adUseClient End Sub
‘’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’� ��’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’
Run-time error ‘-2147467259 (80004005) ‘:
[DBNETLIB][ConnectionOpen(Connect()).]SQL Server does not exist or access denied.
‘’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’� ��’’’’’’’’’’’’’’’’’’’’’’’’’’’’’
I don’t know whether I have got a password or not and if I have I don’t know it. I created the database vb6sql just to test the connection. This is all new to me so if someone could explain in easy to understand step’s I would really appreciate it.
Regards
Nick
