Exforsys

Online Training

QTP script problem

This is a discussion on QTP script problem within the Software Testing forums, part of the Testing category; Hello to all, I have a doubt in QTP script. How can we call database in QTP? Option Explicit Dim ...


Go Back   Exforsys > Testing > Software Testing

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 09-12-2008, 09:57 AM
Junior Member
 
Join Date: Sep 2008
Location: chennai
Posts: 1
deepjyoti is on a distinguished road
QTP script problem

Hello to all,

I have a doubt in QTP script. How can we call database in QTP?



Option Explicit
Dim con,rs
Set con=createobject("adodb.connection")
Set rs=createobject("adodb.recordset")
con.open"provider=sqloledb.1; server=.??????
uid=sa;pwd=sa;database=testdata"
rs.open"select*from emp",con
Do while not rs.eof
VbWindow("Form1").VbEdit("val1").Set rs.fields("v1")
VbWindow("Form1").VbEdit("val2").Set rs.fields("v2")
VbWindow("Form1").VbButton("ADD").Click
rs.movenext
Loop

Please check above script is there any problem. I could not understand about server option on the 5th line of the script ...Please explain in detail?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 09-21-2008, 04:02 AM
kalyansantosh's Avatar
Member
 
Join Date: Feb 2007
Location: Hyderabad
Posts: 91
kalyansantosh is on a distinguished road
Send a message via Yahoo to kalyansantosh
Database Connection


Function Getconnection()
Const adOpenStatic = 3

Const adLockOptimistic = 3

Const adUseClient = 3

Set objCon=CreateObject("ADODB.Connection")

Set objRec=CreateObject("ADODB.Recordset")

objCon.Open "Driver={MySQL ODBC 3.51 Driver};SERVER=120.10.1.215;DATABASE=name;user id=root;password=root; Pooling=True"

objRec.CursorLocation = adUseClient

objRec.Open "Select Max(Productid) as Productid from Products",objCon,adOpenStatic,adLockOptimistic

While(Not objRec.EOF)
val = objRec.Fields.Item("Productid")
MsgBox(val)
objRec.MoveNext
Wend
objRec.Close

objCon.Close

Set objRec=Nothing

Set objCon=Nothing

End Function






Explaination



objCon.Open "Driver={MySQL ODBC 3.51 Driver};SERVER=120.10.1.215;DATABASE=name;user id=root;password=root; Pooling=True"



here we are opening the connection
fst we have to mention driver, Server name,database name, username and password
after identifying the qtp


if any clarifications please mail me kalyansantosh@gmail.com
__________________
Kalyansantosh
Sr QA

Last edited by kalyansantosh; 09-21-2008 at 04:07 AM. Reason: Editing
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools

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 Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads

Thread Thread Starter Forum Replies Last Post
Request for interview question for Testing (QA) wildkid98 Testing Tutorials 17 04-23-2008 05:24 AM
Tutorial on Silk Test spriya279 Testing Tutorials 2 02-15-2007 07:31 PM
Python script problem Zarooka Python 1 04-20-2006 07:46 PM
Unix - Frequently Asked Questions (4/7) [Frequent posting] Ted Timar Tech FAQ 0 05-03-2004 07:54 AM
[FAQ] FileMaker Pro - database for Macintosh and Windows Martin Trautmann Tech FAQ 0 04-17-2004 08:26 AM


All times are GMT -4. The time now is 04:02 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0
Copyright 2004 - 2007 Exforsys Inc. All rights reserved.