Thread Rating:
  • 2 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
error in db connection
#1
Solved: 11 Years, 3 Months, 3 Weeks ago
Code:
Dim con,rs
Set con=CreateObject("ADODB.Connection")
Set rs = CreateObject("ADODB.RecordSet")
con.Provider="DSN=pp;Description=no;UID=sa;PWD=******;APP=QuickTest Professional;WSID=PPI"
con.Open "192.168.1.2" ' this is server name
rs.Open "select * from dummies",con



I m using above code to establish connection with sqlserver2005 but error is coming
as "Provider cannot be found. It may not be properly installed"
while connecting through db checkpoint its working fine.
I m using qtp9.2
Thanks in Advance
Reply
#2
Solved: 11 Years, 3 Months, 3 Weeks ago
Hi

Try this

Initial Catalog is the database that u want to use..


Code:
sConstr="Provider=sqloledb;Data Source=192.168.1.2;Initial Catalog=DBtest;User ID=sa;Password=******;"
Set Db_Connection = CreateObject("ADODB.Connection")
Db_Connection.open sConstr
Db_Connection.Execute "select * from dummies"
Reply
#3
Solved: 11 Years, 3 Months, 3 Weeks ago
Thanx It was perfect.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Question JDBC connection for UFT Anjali09 0 3,640 10-05-2016, 02:19 PM
Last Post: Anjali09
  QTP connection to QC kirangoud 4 15,442 03-02-2012, 03:36 PM
Last Post: kirangoud
  QC-QTP Connection failure uma87 1 3,844 02-28-2012, 03:48 PM
Last Post: inborntester
  SQL Connection String with DSN geethwind 0 5,966 10-05-2011, 05:10 AM
Last Post: geethwind
  Connection to Salesforce Objects nipa1984 0 3,847 09-22-2011, 09:55 AM
Last Post: nipa1984

Forum Jump:


Users browsing this thread: 1 Guest(s)