'The name of Server
strCurrentEnv = "MyServername\JaySQL"
'The name of your database:
dbName = "qtpDemo"
'SQL Server connection string(you need to enter your username and password)
strConnection = "DRIVER={SQL SERVER}; Server=" & strCurrentEnv & "; DATABASE="& dbName& ";uid=sa; pwd="
Set conn = CreateObject("ADODB.Connection")
conn.Open strConnection
'The SQL you want to run
query = "Select * from dbo.hpTools"
Set rs = conn.Execute(query)
dbResults = rs.GetString
print dbResults
strCurrentEnv = "MyServername\JaySQL"
'The name of your database:
dbName = "qtpDemo"
'SQL Server connection string(you need to enter your username and password)
strConnection = "DRIVER={SQL SERVER}; Server=" & strCurrentEnv & "; DATABASE="& dbName& ";uid=sa; pwd="
Set conn = CreateObject("ADODB.Connection")
conn.Open strConnection
'The SQL you want to run
query = "Select * from dbo.hpTools"
Set rs = conn.Execute(query)
dbResults = rs.GetString
print dbResults
Comments