borj
borj

Reputation: 99

What DLL do I need to place at system32 to connect to remote MSSQL using VB6

This is the error:

[DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied.

I'm using 32bit, the server is configured to accept remote access, I can even open it using management studio remotely.

My app is working perfectly in local but not in remote.

this is my connection string:

Provider=SQLOLEDB;Password=1234;Persist Security Info=True;User ID=sa;Initial Catalog=test;Data Source=127.0.0.1

I just change the ip to the ip of remote server, but what dll will I need w/o using ODBC and installing mssql to client unit?

Upvotes: 0

Views: 244

Answers (2)

borj
borj

Reputation: 99

I change my mssql server express to mssql server standard, and it did the trick, no DLL or code changes needed.

Upvotes: 0

George Mastros
George Mastros

Reputation: 24498

Your connection string will only work if you have SQL Server installed as a default instance (because it will default to port 1433). If SQL Server is installed as a named instance (the default for SQL Express), then it will use a random port number.

Do this... On the server,

Click Programs -> 
      Microsoft SQL Server 2008 -> 
      Configuration Tools -> 
      Microsoft SQL Server Configuration Manager

Expand SQL Server Network Configuration
Click on Protocols
Make sure TCP/IP is enabled
Right click on TCP/IP
Click Properties
Click IP Addresses
Scroll down to IPAll.
Take note of the TCP Dynamic Ports.

Once you determine the port to use, then you can modify your connection string.

Provider=SQLOLEDB;Password=1234;Persist Security Info=True;User ID=sa;Initial Catalog=test;Data Source=127.0.0.1,12345

Of course, change the 12345 to the actual port number you discovered in the previous step.

Upvotes: 1

Related Questions