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
how do u plan test automation?
Why script error occur in between recording in qtp?
iam have done mba(finance)in 2008. in 2008 one reputed consultancy came off campus interview our institution. i got job as "manual test engineer". now iam working as "manual testing engineer". now my problem is when iam going interview the interviewer asking like " ur mba gradute how can u get job in test engineer." this question i have faced every interview. iam explaining how iam getting job. but they are not trust me". pls tell me answer how i am giving relavent ans.. this is my mail id y.ramana84@gmail.com
in data driven testing for performing operations which method is easy from manual test data,keyword view,or from database.and why?
Write a QTP script to enter a keyword in to Google search engine?
Will down time for server and content maintenance/upgrades be allowed? how much?
How to do the scripting. Is there any inbuilt functions in qtp as in qtp-s.
Will there be any standards or requirements for page appearance and/or graphics throughout a site or parts of a site?
Pls can anybody send me the Recent Technical and Interview Questions Which were asked in IBM(QTP)Automation PLZZZZZZZZZ
What will be happen if i load object repository at run time, but it has already associated.
In application which areas to be automated and what kind of situation will be take? using QTP? Plz give me the clear answer
How can you identify the browser and its information using QTP script?
How to recognise the webelement and verifying that webelement is enabled?
How to modify the text checkpoint?
How to use the object spy in quicktest professional 8.0 version?