// Sample Code to Connect to database in Test Complete
Set AConnection = ADO.CreateADOConnection
' Specify the connection string
AConnection.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=master;Data Source=DG18\SQLEXPRESS"
' Suppress the login dialog box
AConnection.LoginPrompt = False
AConnection.Open
' Execute a simple query
Set RecSet = AConnection.Execute_("SELECT * FROM holding")
' Iterate through query results and insert data into the test log
RecSet.MoveFirst
While Not RecSet.EOF
Log.Message RecSet.Fields("Script").Value
RecSet.MoveNext
Wend
AConnection.Close
Thursday, October 29, 2009
Subscribe to:
Post Comments (Atom)
Thats cool, but what should i do if i am connecting to a remote DB and it needs to fill the user name and password?
ReplyDelete