Ultimatetimepass logo

  • Home
    • QuickTest
      • Webbased
        • Close Opened Browsers Except QC
        • open/ launch a new session of IE
        • GET COUNT AND NAMES OF ALL OPEN BROWSERS
        • Get No of links in a page- Descriptive programming
        • Function to click on menu (Mimic the user action)
        • Function to display type ahead list in a dropdown
        • Drag and Drop the files into application
      • XML
        • Read XML
        • Create XML
        • Merge 2 XML
      • Excel
        • Read Excel using ADODB connection
        • Delete Columns from excel sheet
        • Delete Rows From excel sheet
        • Excel Sorting
        • Save as a Password Protected Excel sheet
        • Open a Password Protected excel and save as unprotected
        • Find a value in Excel Sheet
        • Create and update a excel File at given path
        • To Query a Excel Sheet as a database
      • VBScript
        • To type keyboard input onto the open window
        • Send or Type a key on the application using wscript.shell
        • Set a default Printer
        • To Verify an Application launch
        • Verify and delete a file to a specific location
        • Create MS Word, Edit and Print a blank page
        • Create a MS Access(.mdb) database file
        • Import a XML file to MS Access database
        • Connect to SQL Server
        • Connect to MS Access DB
        • Create a Text File at given path
        • Read a text file and store data in a variable
        • Get number of pages in pdf
    • VBScript
      • Generate a chart in excel
      • Map a netwrok drive
      • Retrieve computer operating system name
      • Kill a task manager process
      • Make a message alert with ding sound using Microsoft Office assistant popup
      • Include a functional library or any other VBscript code available in your current script
    • TestPartner
      • Launch TestPartner from VBscript or any other tool
    • Software Risk Management
    • Software Testing Estimation Techniques
    • Capability Maturity Model Integration (CMMI)
    • Test Policy, Test strategy ,Test Plan
    • Load Testing
      • Load Test Test Plan
      • Performace, Load and Stress test
  • Contact US
  • Privacy Policy

Connect to SQL Server

  • Print
  • Email


Connection string fro SQL Server, use following code:
Steps:

1) Create an ADODB connection  with provider as "sqloledb"

2) Open database connection

Code:

'Connect to SQL Server
'==============================================
Function Create_SQL_Connection(DataSource,Ini_catalog)
'1) Create an ADODB connection  with provider as "sqloledb"'
set SQLcon= CreateObject( "ADODB.Connection")
SQLcon.ConnectionString = "Provider='sqloledb';Data Source='" & DataSource & "';" & _
          "Initial Catalog='" & Ini_catalog & " ';Trusted_Connection=YES"
'2) Open database connection'
SQLcon.Open
End Function