How do you connect to database ,What is the script to
connect DATA BASE?

Answers were Sorted based on User's Feedback



How do you connect to database ,What is the script to connect DATA BASE? ..

Answer / sandipgami84

u need to put above code in "GetSQLData" Function

Is This Answer Correct ?    3 Yes 1 No

How do you connect to database ,What is the script to connect DATA BASE? ..

Answer / sandipgami84

u need to installed "mysql-connector-odbc-3.51.27-win32",
then write down below code,

Dim objCon, ObjRecordSet
ConnString = "Driver=MySQL ODBC 3.51 Driver; server=ServerIP"
ConnString = ConnString &";database=DBName"
ConnString = ConnString &";user=DBusername"
ConnString = ConnString &";password=DBPassword"
Set objCon = createobject("ADODB.Connection")
objCon.Open(ConnString)
Set ObjRecordSet = CreateObject("ADODB.Recordset")
ObjRecordSet.Open CStr("Select * From tbName Where Id =
'1'),objCon
If (not ObjRecordSet.EOF) then
For I = 0 To ObjRecordSet.Fields.Count - 1
If I = 0 Then
On Error Resume Next
GetSQLData = Trim(Cstr(ObjRecordSet.Fields(I)))
Else
On Error Resume Next
GetSQLData = Trim(CStr(GetSQLData)) & "," &
Trim(CStr(ObjRecordSet.Fields(I)))
End If
Next
End If
ObjRecordSet.close
objCon.close
Set ObjRecordSet = Nothing
Set objCon = Nothing
DataBaseConnection = GetSQLData
GetSQLData = ""




-----------
Sandip Gami
+91-9714177088

Is This Answer Correct ?    2 Yes 1 No

Post New Answer

More QTP Interview Questions

what is the data driven testing?

0 Answers  


How to Analyze the Checpoint results by Text/Text Area Checkpoint?

1 Answers  


how can i prepare for QTP(8.2) to face interview ? give over view details?

52 Answers  


Hi any body pls help me for QTP 11.0 software free demo version. i have to practice. Kindly send the link.or where i have to download.

0 Answers  


a title of first page is "LKO- microsoft internet explorer", of the second page is "PPM- microsoft internet explorer" , of Third page is "TTS- microsoft internet explorer" and same changing title on the fourth page. How can we use regular expression for this feature what should we do on script part on and Object repository part so that we can get successful run result. Kindly explain the steps script.

2 Answers  


get the order no from the following orderdetails orderstring="ORD13456PNR" eg:13456

10 Answers   Oracle,


How many ways we can parameterize data in quicktest professional (qtp)?

0 Answers  


What is the differences between image check point and bit map check point?

0 Answers  


How can we use regular expressions for a table in web page, each cell in table having unique identification, Now I want to count number of rows in table and enter data in all cells of the table?

1 Answers   CTS,


1...HOW MANY TYPES OF OBJECT REPOSITORY ARE THERE IN QTP? 2....WHAT ARE THE REPOSITORY FEATURES EXPLAN. 3...HOW TO CREATE A RECOVERY SCENARIO? WHAT DOES RECOVERY SCENARIO MANAGER DO? 4...OPEN A WORD FILE AND MODIFIED WITH SOME VALUE USING QTP? 5... HOW TO CREATE EXCEL FILE USING QTP? 6... HOW TO RETRIEVE A VALUE FROM WEB TABLE? 7... WHAT IS QC REQUIREMENT TAB DO ? HOW TO MAP THE REQUIREMENT? 8... HOW TO PASS A VALUE FROM EXCEL FILE TO SCRIPT? 9...WHAT IS THE USE OF SPLIT FUNCTION?

1 Answers   RBS,


How will u test content of an web application with out using chechpoints in QTP 9.2?

3 Answers   CTS,


assume i have few url link how will i dynamically call then using descriptive programming?

0 Answers   BirlaSoft,


Categories