Highlighted
Honored Contributor.
Honored Contributor.
231 views

Finding some code in UFT

Hi all,

I found some code for QTP but can not find in UFT like: 

https://stackoverflow.com/questions/19706258/execute-stored-procedure-and-return-resultset

adCmdText would be for SQL query if you want to execute a stored procedure then you have to use adCmdStoredProc (value 4 instead)

EDIT:

'Set the connection
'...............

'Set the command
DIM cmdSET cmd = Server.CreateObject("ADODB.Command")
SET cmd.ActiveConnection = Connection

'Set the record set
DIM RSSET RS = Server.CreateObject("ADODB.recordset")

'Prepare the stored procedurecmd.CommandText = "[dbo].[sptestproc]"cmd.CommandType = 4  'adCmdStoredProc
cmd.Parameters("@Option1 ") = Opt1 
cmd.Parameters("@Option2 ") = Opt2 

'Execute the stored procedure
SET RS = cmd.ExecuteSET cmd = Nothing

Anyone can help in this case.

Thanks

0 Likes
4 Replies
Highlighted
Honored Contributor.
Honored Contributor.

Re: Finding some code in UFT

pls help in this case

0 Likes
Highlighted
Knowledge Partner
Knowledge Partner

Re: Finding some code in UFT

Have you tried adding the code to a vbs file in a function, associating the vbs (library) file to UFT and running it?

Mark Smith.

0 Likes
Highlighted
Honored Contributor.
Honored Contributor.

Re: Finding some code in UFT

Not yet, Can you give some examples for this?

0 Likes
Highlighted
Knowledge Partner
Knowledge Partner

Re: Finding some code in UFT

Just spotted something:

cmd = Nothing

Should be on a seperate line after creating the recordset

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.