![]() |
|
Retrieve the Data from Database - 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: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming) +--- Thread: Retrieve the Data from Database (/Thread-Retrieve-the-Data-from-Database) Pages:
1
2
|
Retrieve the Data from Database - bfakruddin - 12-22-2008 I connect to database by code and imported data and placed in fields of application and validate some functionalities.... no problem up to here... when QTP tries to import second record from database... it is importing first record again... Can I know my mistake...? RE: Retrieve the Data from Database - Ankur - 12-22-2008 Put your properly formatted code here. RE: Retrieve the Data from Database - bfakruddin - 12-29-2008 Thank You Ankur, Now I am getting... No issues Code: Option ExplicitRE: Retrieve the Data from Database - sudhirzpatil - 02-12-2009 Hi bfakruddin , I am trying same as you. In this i am getting Login(Agent name) directly from database. But when it comes to Password it says operation can not Performed. See part of code is Code: arr=rs.fields("Login_name")Here Agent Name get inserted from Database. But For Password field it says " Operation can not performed" Can you pls help me. RE: Retrieve the Data from Database - bfakruddin - 02-12-2009 as part of your code is correct........ check once you get a value from database whether it is retrieved from there or not.... use msgbox pwd it will show whethet value has been retrieved or not... If it is not? I hope no chance because database has been already connected and got a Login_name, check the column name is pwd or something else... "Easy method to connect to any database" --> open new text file and save as "babaDB.udl" one icon will appear at the text file location, double click on that and select your desired database and provide the user name password... navigation would be very simple, you can understand easily... give the info what it asks and close it... Right click on that icon and open with "Note Pad"... copy the available text and keep it in your code at the place of con.open "copied text here" 'use it if you feel difficult to remember all the server,localhost, username, password... etc., ;D RE: Retrieve the Data from Database - sudhirzpatil - 02-13-2009 Hi bfakruddin , I placed 'msgbox pwd' , and its showing 'mercury'. it means it is getting properly. But i think while inserting it is inserting something else. What i guess is it is inserting ( space ) as extra string.Bcoz Login wondow says, Incorrect password.I also observed the extra element. as for mercury(*******) there should be only 7 asterstiks. But what i observed is (********) i.e eight. Even check that while Agent Name get inserted observe the Position of cursor,it is on the last position of that field. I guess same thing may be happen for Password also. What You say, if it , its real challange! I stll not tried your second method,but first trying the first one. Lets see....will get back you soon if solved. RE: Retrieve the Data from Database - bfakruddin - 02-16-2009 if that is a case... that is not an issue buddy use built-in function trim to ignore spaces try this Code: arr=rs.fields("Login_name")RE: Retrieve the Data from Database - sudhirzpatil - 02-16-2009 Yes ! now it works. Thanks. Can you please give me such built in function used in QTP ? Or where i can found so that i can use them whereever necessay. RE: Retrieve the Data from Database - newqtp - 02-17-2009 I have been trying this as for practice and I have found out that DSN=QT_Flight32 (Mercury flight reservation application) does not have any table containing Userid and Password information. Code: arr=rs.fields("Userid")OR Code: arr=rs.fields("Login_name")RE: Retrieve the Data from Database - Ankur - 02-17-2009 (02-16-2009, 12:07 PM)sudhirzpatil Wrote: Yes ! now it works. Thanks. Built In function in QTP can be found under VB Script reference > VB Script > Reference > Functions |