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 to give a call to another action from one action?
What is parameter in qtp?
what is stepin & stepout?
what is key word driven frame work ? why it is called like that ? what is the diference between keyword driven and data driven frame work ?
Explain in brief about the quicktest professional automation object model?
Hi could some one explan what is the use of the function Defination generator, And how to use the function defination generator.. Explan with the example..
Can any one tell me.......How the test engg's start testing in the compy environment.....real time tester PLSSSS help me i need in depth information regarding this...
How do I lauch my test website using code from qtp in different environmet, uat and PPTE?
Consider one application is open, clicking one menu will open another application in another browser. QTP does not catch the URL of the second browser(second application). can we capture it ?
What are the factors on which script execution time is dependent?
What is difference between Recording time object identification and Run time (Execution) time.
Hi there, I've installed a trial version of QTP to see if it works with my product but I cant automate selecting windows from a tree view? Can anyone give me any pointers? Many Thanks
What is Curd testing?
write a script to verify links on any web page by using descriptive method by creating a description object (give a filter condition only link) ... need to verify expected like name by reading
What is method name to compare two XML files.