Prepare for your Next Interview
|
Welcome to the Geeks Talk forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
This is a discussion on Retrieve the data from database within the QTP forums, part of the Software Testing category; How to retrieve the data from database in qtp...
|
|||||||
|
|||
|
Hi Rajaputra,
Create a connection to your database using the following code - Set dbObj = CreateObject("ADODB.Connection") dbObj.provider = :Name of Provider: - Microsoft Jet 4.0 incase of MSAccess dbObj.connectionString = :Name of Sever:;UserID:username:;Pws= assword:;Initial_catalog = BName:dbObj.Open Set rsObj = createObject("ADODB.Recordset") rsObj.open(dbObj) rsObj.open "Select * from tablename where conditions" set ar[1] = rsObj.fields(0) The above line basically extracts field values and inserts them into an array for further use. let me know if this helps - Cheers. |
|
|||
|
Re: Retrieve the data from database
Naweb and all, need help for the below code - got them somewhere on this site and modified for specific need... However, it has not been tested bucuase still have questions. Please focuss within the "select" and display data (last part) const adopenstatic = 3 const adlockoptimistic = 3 const aduseclient = 3 set objcon=createobject("adodb.connection") set objrec=createobject("adodb.recordset") ' establish connection - what shoud be for driver - give example? path? select case option case 1 objcon.open "driver={oracle in orahome92};server=oservername;uid=userid;pwd=upwd;dbq=database" case 2 objcon.open "driver={oracle in orahome92};server=oservername;uid=userid;pwd=upwd;dbq=database" case 3 objcon.open "driver={oracle in orahome92 (what shoud be here};server=oservername;uid=userid;pwd=upwd;dbq=database" case else msgbox("invalid ???.....") existtest end select objrec.cursorlocation = aduseclient -> what this is doing? ' fetch tempt uid objrec.open "select substr(body, instr(body, 'user id: ')+9, instr(body, 'password: ')) as id, substr(body, instr(body, 'password: ')+10, instr(body, '3. Follow')) as pwd from database.datable", objcon, adopenstatic, adlockoptimistic msgbox "result" & objrec.fields.item("id") & vbcrlf & objrec.fields.item("pwd") & vbcrlf ' flush out objrec.close objcon.close set objrec=nothing set objcon=nothing msgbox "executed sucessfully"
|
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Retrieve data from webpage | Geek_Guest | QTP | 3 | 06-03-2009 06:42 AM |
| Retrieve data from emp table | Sampurna | SQL | 4 | 08-13-2008 08:07 AM |
| How to retrieve data from SAP | chinna.kk | Data Warehousing | 0 | 09-04-2007 03:38 PM |
| Retrieve the data which are only duplicates | Geek_Guest | SQL | 3 | 06-26-2007 09:15 AM |
| Retrieve a pdf document from database | Lokesh M | Database General | 5 | 12-18-2006 08:44 AM |