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 ...
|
|||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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? |
|
||||
|
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 |
![]() |
| Thread Tools | |
|
|
|
||||
| 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 |