Thread View: bit.listserv.powerh-l
1 messages
1 total messages
Started by iamqa
Mon, 06 Mar 2006 21:03
SQL query in QTP
Author: iamqa
Date: Mon, 06 Mar 2006 21:03
Date: Mon, 06 Mar 2006 21:03
37 lines
2205 bytes
2205 bytes
II have 2 questions.First, i want to pass a parameter to the SQL query. Is this possible. If so how?. Second, does 'Declare' statement (SQL query) work in QTP? 1) In my script, I have created a Output Database Check point. In that I created a connection string and given the query as "Select sum(amount) from Income where app_id=10". The returend value is stored in a datatable. And i access the value from there. I am able to do this though a hardcoded 'app_id'. But the real help is in parameterizing the app_id. And I tried to do like this: In QTP: Dim Page; In SQL Query: Declare @app int Set @app= Page Select sum(Amount) from Income where app_id=@app But I didnt see any place for connecting the 'Page'variable to the SQL statement in QTP. Where I can pass the 'Page' variable to the SQL script? 2) I also tried doing this: In SQL Query: Declare @app int Set @app= 10 Select sum(Amount) from Income where app_id=@app But this is not working. When i run my script, it says '[Microsoft][ODBC SQL Server Driver][SQL Server]Changed database context to xxx'. Can any one help me with these issues. Thanks
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads