How do you connect to database ,What is the script to
connect DATA BASE?
Answers were Sorted based on User's Feedback
Answer / sandipgami84
u need to put above code in "GetSQLData" Function
Is This Answer Correct ? | 3 Yes | 1 No |
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 |
What is a programmatic description?
what is defination of regression testing?
Tell me few important difference Between QTP and WinRunner?
what is the difference between DP and keyword driven framework?
can u write Script to do Data Driven Testing throuh Externel & internel XL Sheet
What type of error u will get if u have not installed java add in in java project? what is the error name ?
For Data-Driven testing can you use micro soft word document instead of using Datatable what is your approach?
What all challenges you have faced during automation and how you have resolved it?
How To write script in QTP For Field Validation Example: password Field is accepting A range 8-20 characters only.How to write script?
How to convert non-reusable action into reusable action in QTP?(i know by default QTP will take it as a non-reuable action )(Chandana) plz urgent?
How to create basic scripts from a manual test case in QTP?
Syntax for how to call one script from another and Syntax to call one "Action" in another?