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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OLEDB Connection to SQL Server problem

Status
Not open for further replies.

vbajock

Programmer
Jun 8, 2001
1,921
US
I am having problems setting up an OLEdb connection to SQL Server 2000. Here is the code I am using:

Function OpenSqlServer()

On Error GoTo OpenSqlServerConnection_err

SqlServer.Open "Driver=SQL Server;Server=FS4;Database=MasterSchedule;UID=dbADMIN;PWD=dbpass"



OpenSqlServer = True

Exit Function

'***********************
OpenSqlServerConnection_err:
'***********************

MsgBox Str$(Err) + Error$

OpenSqlServer = False

Resume
End Function

The error I receive is:
"User not associated with a trusted SQL Server connection"
I set the user dbAdmin up in SQL server and gave it admin rights. I have also tried the sa user and got the same error. I can find nothing in the help files on "trusted connection". The job runs on the same machine as the SQL Server. Thanks in advance for your help.


 
Ok, figured it out myself, here's the code

Function OpenSqlServer()

On Error GoTo OpenSqlServerConnection_err

Set SqlServer = New ADODB.Connection
SqlServer.Provider = "SQLOLEDB"
SqlServer.ConnectionString = "Data Source=FS4;Initial Catalog=MasterSchedule;Trusted_Connection=Yes"
SqlServer.Open


OpenSqlServer = True

Exit Function

'***********************
OpenSqlServerConnection_err:
'***********************

MsgBox Str$(Err) + Error$

OpenSqlServer = False
' SqlServer.Close
Resume




End Function

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top