Interview Questions   Tutorials   Discussions   Programs   Videos   

QTP - What is the Vbscript to connect Database?




304
views
asked marvit August 21, 2014 06:07 AM  

What is the Vbscript to connect Database?


           

1 Answers



 
answered By Dharma   0  
Const adOpenStatic = 3
Const adLockOptimistic = 3

Set objConnection = CreateObject("ADODB.Connection")
Set objRecordSet = CreateObject("ADODB.Recordset")

objConnection.Open _
  "Provider=SQLOLEDB;Data Source=atl-sql-01;" & _
    "Trusted_Connection=Yes;Initial Catalog=Northwind;" & _
       "User ID=fabrikam\kenmyer;Password=34DE6t4G!;"

objRecordSet.Open "SELECT * FROM Customers", _
    objConnection, adOpenStatic, adLockOptimistic

objRecordSet.MoveFirst

Wscript.Echo objRecordSet.RecordCount
	
flag   
   add comment

Your answer

Join with account you already have

FF

Preview


Ready to start your tutorial with us? That's great! Send us an email and we will get back to you as soon as possible!

Alert