http://gallery.technet.microsoft.com/scriptcenter/a6a9d2a4-705f-4e37-86db-33caca7473cb
Im using above script but get and error.
The setup is mssql express 2012
DB name: testdb
DB user: testusr
pass: Test12345
Server: testsrv
From another mashine could i fine connect to the server with server management studio with above info:
Servername: testsrv\sqlexpress
Auth: SQL Server Authentication
Login: testusr
Pwd: Test12345
I have updatet the script with my info:
Const adOpenStatic = 3
Const adLockOptimistic = 3
Set objConnection = CreateObject("ADODB.Connection")
Set objRecordSet = CreateObject("ADODB.Recordset")
objConnection.Open _
"Provider=SQLOLEDB;Data Source=testsrv/sqlexpress;" & _
"Trusted_Connection=Yes;Initial Catalog=testdb;" & _
"User ID=testusr;Password=Test12345;"
objRecordSet.Open "SELECT * FROM [testdb].[dbo].[Persons]", _
objConnection, adOpenStatic, adLockOptimistic
objRecordSet.MoveFirst
Wscript.Echo objRecordSet.RecordCount
Get this error:
Line 7, char 1
[dbnetlib][connectionopen (Connect()).]SQL Server does not exist or access denied.
code. 80004005
Source: Microsoft OLE DB Provider for SQL Server
Helpdesk Supporter