where do my return values go? (SQL-Query) - Printable Version +- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums) +-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP) +--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners) +--- Thread: where do my return values go? (SQL-Query) (/Thread-where-do-my-return-values-go-SQL-Query) Pages:
1
2
|
where do my return values go? (SQL-Query) - Tim.Schmidt - 07-08-2008 Hi everybody, I use Code: objDatabase.execute(querystr) in a fucntion, whereas the querystr is a select statement, which is tested to work properly. when assigning it to a variable Code: functionname = objDatabase.execute(querystr) I am using the name of the function as the variable, to pass the value returned to an if clause. Code: if functionname() = "1" then QTP gives me an error msg: "Wrong number of arguments or invalid property assignment." and quotes the line I am using the function in. (shown above) Am I doing something wrong? Did i forget anything? Any help would be great RE: where do my return values go? (SQL-Query) - somisays - 07-08-2008 Hi, Can you give more information on SQL query.... What is your SQL query ?This depends on what SQL query returns. If you want to connect database read the following post https://www.learnqtp.com/forums/Thread-DatabaseExample RE: where do my return values go? (SQL-Query) - Tim.Schmidt - 07-08-2008 The Connect works, the query works, all tested. the query will either return a "0" or a "1", or nothing ofc. RE: where do my return values go? (SQL-Query) - somisays - 07-08-2008 if functionname() = "1" then Hi, In the above code why you are using() ? Because you already got the returnvalue in functionname ? Take out the () out and try. I think if you post the code then we can help you... RE: where do my return values go? (SQL-Query) - Tim.Schmidt - 07-08-2008 that was just an example. Actually its if CheckStat(AppID) = "1" then (for AppID insert number from 1-12, it is used in the query later) Full Code for the Function: Code: Function CheckStat (AppID) RE: where do my return values go? (SQL-Query) - Tim.Schmidt - 07-09-2008 Hi again, I tested some stuff. Code: msgbox (objDB.Execute(Querystr)) doesnt work at all I presume (type mismatch), just smth I wanted to try to make sure he gets the right value from the database. back to topic: anybody have any idea how to resolve this issue? Maybe Options/Preferences that need to be configured? the issue is rather urgent, any help would be very good! RE: where do my return values go? (SQL-Query) - surya_7mar - 07-09-2008 Below is the code using which you can retieve data from the DB and stores in a Sample Array Code: Function GetDBQueryData_Fun (sClient, sQuery) RE: where do my return values go? (SQL-Query) - Tim.Schmidt - 07-09-2008 Do I really need all that code?? I just want 1 value returned, so I dont need a whole array. There is no way around the RecordSet? RE: where do my return values go? (SQL-Query) - somisays - 07-09-2008 Dear Tim, How many columns you are retrieving in the SQL query ? RE: where do my return values go? (SQL-Query) - Tim.Schmidt - 07-09-2008 Hi somisays, I retrieve 1 Column, with 1 Value (line). nothing more. |