Wednesday, February 15, 2012

Running Database Procedure using qtp

Following code can be used to execute the database procedure. Before proceeding you must know the connection-string to connect the database & the name of the procedure. If you dont know the connection-string of your database refer . This website provides an easy reference to connection-strings for various databases.

Set conn = CreateObject("ADODB.Connection")
Set adocommand = CreateObject("ADODB.Command")

conn.ConnectionString = "Connection-string of the running database"

Set adocommand.ActiveConnection = conn
adocommand.CommandText = "Name of the Stored Procedure"
adocommand.CommandTimeout = 30
adocommand.CommandType = 4



Set adocommand = Nothing
Set conn = Nothing

No comments:

Post a Comment