First u create the parameter in command object after crateting u can assgin
the datatype also

syntax

cm.CommandText = StoredProcedureName

Set x=Cm.createparameter("name","datatype",length)


On Mon, Jul 27, 2009 at 2:59 PM, Dhanya A <[email protected]> wrote:

>
> Hi All,
> I have tried to execute a stored procedure from QTP. Please find below
> the script that I have used. I am not sure whether this is correct or
> now. I have referred so many sites and worked on this. The below
> script was executed without any error. Anybody please tell me how to
> output the results after executing the stored procedure.
>
> Function RunStoredProcedure(StoredProcedureName)
> ''Create the database object
> Set cm = CreateObject("ADODB.Command")
> ' Activate the connection.
> Set rs=createobject("adodb.recordset")
> cm.open"provider=sqloledb.
> 1;server=servername;uid=username;pwd=passowrd;database=databasename"
> ' Set the command type to Stored Procedures
> cm.CommandType = 4
> ' Stored Procedures
> cm.CommandText = StoredProcedureName
> ' Define Parameters for the stored procedure
> cm.Parameters.Refresh
>
> ' Execute the stored procedure
> cm.Execute()
>
> Set cm = Nothing
> End Function
>
>
>
> Thanks and Regards,
> Dhanya
>
>
>
>
>
>
>
>
>
>
>
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
"QTP - HP Quick Test Professional - Automated Software Testing"
group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/MercuryQTP?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to