Micro Focus QTP (UFT) Forums
regarding connection string - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: regarding connection string (/Thread-regarding-connection-string)



regarding connection string - soumya - 12-06-2011

Good evening

How do we get the connection string?
i understand that in order to retrieve data from a database, we have to establish a connection string. but how do we get it.
For the sample application, the database is MS access. but in real time we do not always get MS Access.

So how do we obtain the connection string for different databases. i have sql server 2005 installed.
can you please explain ?

Thank you so much



RE: regarding connection string - sshukla12 - 12-07-2011

Hi,

This might be useful to you.

Code:
Function GetDataFromBase(DNS,UID,PWD,QUERY)

    Set MyConnection = CreateObject("ADODB.Connection")
    Set myrecordset = CreateObject("ADODB.recordset")

    MyConnection.ConnectionString ="DSN=" & DNS  & "; UID=" & UID & ";PWD=" & PWD

    MyConnection.Open
    Set myrecordset = MyConnection.Execute(QUERY)
    GetDataFromBase = myrecordset(0)
    MyConnection.Close

End Function


Regards,
Sankalp


RE: regarding connection string - ravi.gajul - 12-07-2011

Please check the below url for connection string
http://www.connectionstrings.com/sql-server-2005