UKmedia
Programmer
- Nov 2, 2002
- 90
Hey Guys,
I have a problem with connecting to a MS SQL database through a script. It works prefect on my login as I am a domain admin bu on normal users it fails to connect with the error:
Login failed for user 'DomainName\Username'
I have posted the code for you to review but I am passing the server, database, username, password to use already through the connection string.
UKmedia productions
I have a problem with connecting to a MS SQL database through a script. It works prefect on my login as I am a domain admin bu on normal users it fails to connect with the error:
Login failed for user 'DomainName\Username'
I have posted the code for you to review but I am passing the server, database, username, password to use already through the connection string.
Code:
'Connect to SQL and store the results in the table
Const adOpenStatic = 3
Const adLockOptimistic = 3
Set objConnection = CreateObject("ADODB.Connection")
Set objRecordSet = CreateObject("ADODB.Recordset")
objConnection.Open _
"Provider=SQLOLEDB;Data Source=ULTRATECIDB;Trusted_Connection=Yes;Initial Catalog=openfire;UserID=username;Password=password;"
objRecordSet.Open "INSERT INTO jiveLoginStatus(Jdate,Jtime,Jip,Jcomputer,Jusername,Jstatus) values('" & Date() & "','" & Time() & "','" & IP_ADDRESS & "','" & strUsername & "','" & strComputer & "','" & strStatus & "')", _
objConnection, adOpenStatic, adLockOptimistic
UKmedia productions