How do you connect to database ,What is the script to
connect DATA BASE?
Answer Posted / 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 View All Answers
Anybody plz give, How do you test aframe in a web page? If page cotain text message or Images, tables?
What are the different kinds of test steps?
What are the different recording modes and how do they work?
What is qtpro? What is quick test pro? What is a quick test professional?
How to creating an output value using quicktest professional?
banking domain description for software tester for interview
How to break the object spy ?
Create flight reservation login descriptive programing (Condition: Remove the value and substitute with a variable, and then call the validation from Excel) Plz help me....... very urgent.........
What does it mean when a check point is in red color? What do you do?
Hi , I am facing issue QTP 10.0 with oracle ERP 11i .When QTP opens,click sub links on ERP ,FORM is not opening getting unexpected Internet explorer error message with send or don't send report.So unable to work with forms using QTP.
What is checkpoints for quicktest professional?
To which environments does quicktest professional (qtp) supports?
Explain the features of quick test pro(qtp)?
What is action?
What are the differences between qtp and winrunner?