Geeks Talk

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.

Retrieve the data from database

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...

Go Back   Geeks Talk > Software Testing > QTP
Register Blogs FAQ Tag Cloud Calendar Mark Forums Read
  #1 (permalink)  
Old 10-24-2007
Expert Member
 
Join Date: Sep 2007
Location: Hyderabad
Posts: 115
Thanks: 1
Thanked 19 Times in 15 Posts
rajaputra is on a distinguished road
Retrieve the data from database

How to retrieve the data from database in qtp
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 10-31-2007
Expert Member
 
Join Date: Oct 2007
Location: Mumbai
Posts: 354
Thanks: 4
Thanked 58 Times in 47 Posts
bizzzzzare will become famous soon enough
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.
Reply With Quote
  #3 (permalink)  
Old 08-28-2008
Expert Member
 
Join Date: Jun 2008
Posts: 212
Thanks: 6
Thanked 12 Times in 11 Posts
learqtptesting is on a distinguished road
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"
Reply With Quote
Reply

  Geeks Talk > Software Testing > QTP

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are Off


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


All times are GMT -4. The time now is 10:59 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.3.1
Copyright © 2009 GeekInterview.com. All Rights Reserved