Friday, February 4, 2011

How to Call SQL stored procedure in QTP?

for Technical interviews:

http://no1tutorial.com/

learn step by step technologies:


http://no1tutorial.com/
How To Make Career In QTP: How to create Array in QTP?

How to Call SQL stored procedure in QTP?


Function RunStoredProcedure(StoredProcedureName)
sDatabaseName=”ABC”
sUID=”xyz”
sPWD=”ABC_xyz” ‘ Create the database object
Set cm = CreateObject(”ADODB.Command”)
‘ Activate the connection.
cm.ActiveConnection = “DRIVER={Microsoft ODBC for Oracle}; ” &_
“SERVER=” & sDatabaseName & “;User ID=” & sUID & “;Password=” & sPWD & ” ;”
‘ Set the command type to Stored Procedures
cm.CommandType = 4
‘ Stored Procedures
cm.CommandText = StoredProcedureName
‘ Define Parameters for the stored procedure
cm.Parameters.Refresh
‘ Pass input value. Assuming Stored Procedure requires 2 parameters
cm.Parameters(0).Value = “Kuldeep”
cm.Parameters(1).Value = “Kumar”
‘ Execute the stored procedure
cm.Execute()
Set cm = Nothing
End Function

for Technical interviews:

http://no1tutorial.com/

learn step by step technologies:


http://no1tutorial.com/

No comments:

Post a Comment