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

Explain roles and responsibilites of 2yrs Automation qtp engineer.

3 Answers   Oracle,


What are the different scripting languages you could use when working with QTP ?

6 Answers  


Can we Script any test case with out having Object repository? or Using Object Repository is a must

3 Answers   Crea,


Among all the check points what is the most important checkpoint?

1 Answers  


Can the mode of object repository be change during run time? Eg. if the mode is per-action during design time can i change it to shared and vice-versa? Any scripting possible?

2 Answers  






some times we write user define functions.where we write main and sub program,how,where to insert the functions in qtp?

2 Answers   GE,


What are different versions in Win Runner ,QTP ,Load Runner and Test Director till now and atleast please let me know new features for each version. Ex QTP8.2,QTP 8.5.QTP9.2 supports Mozilla 2.0

1 Answers   DELL,


how can we test load time of an page in webtesting?

3 Answers   Ordain Solutions,


what is the diffrence between script and Language ? (Chandana)

6 Answers   Cognizant, Wipro,


What does VBS file contain...??? what is VBS file.. ???

6 Answers   GE,


What is the difference between two actions?

1 Answers   Wipro,


how to do the batch testing in test director using manual testing procedure?

0 Answers  


Categories