Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't Connect to Sql Using ADO

Status
Not open for further replies.

Blauther

Programmer
Jan 8, 2002
15
US
I'll start this off by saying that I have a development environment where all my code and stored procedures work fine.
I installed a similiar system in another location, and the client application can't connect to the SQL Server Database.

Here are the system Specs:
Home
-Server = Win2000 Professional
-SQlServer = SQL Server 2000 Developer
-Client Machine OS = Win2000 Professional SP2

Other Location
-Server = WinNt 4.0 SP6
-SQL Server = SQL Server 2000 Enterprise
-Client Machine OS = Win2000 Professional SP2

The code that I am using to connect to the server is at the end of this post.

The variables that start with a lower case "g" all contain the proper info during execution.

Note: I installed the application that accesses the server directly on the server, and it works just fine!

When installing SQL Server, most of the defaults were taken.

PLEASE HELP...Someone please help while I still have some hair on the top of my head that hasn't been pulled out yet!


Dim rsRecordset As ADODB.Recordset
Dim sConnectionString As String
Dim sSql As String

Set rsRecordset = New ADODB.Recordset

sConnectionString = "Provider=SQLOLEDB;Persist Security Info=True;User ID=" & gSqlUserId & ";Initial Catalog=" & gDatabaseName & ";Data Source=" & gServerName & ";Network Library=dbmssocn" & ";Password=" & gDatabasePassword
sSql = "Select ClientAppVersion from tblCLientAppInfo "

With rsRecordset
.CursorLocation = adUseClient
.Open sSql, sConnectionString, adOpenStatic, adLockBatchOptimistic
End With

msgbox rsRecordset.Fields("ClientAppVersion")

rsRecordset.Close
Set rsRecordset = Nothing
 
There is no DSN set up on either client machine.

I didn't think that I needed a DSN if I specify the Network library in the connection string:
Network Library=dbmssocn

--Brian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top