Results 1 to 3 of 3

Thread: Retrieve the data from database

  1. #1
    Expert Member
    Join Date
    Sep 2007
    Answers
    110

    Retrieve the data from database

    How to retrieve the data from database in qtp


  2. #2
    Expert Member
    Join Date
    Oct 2007
    Answers
    375

    Smile Re: Retrieve the data from database

    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.


  3. #3
    Expert Member
    Join Date
    Jun 2008
    Answers
    204

    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"


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact