title: VBScript how to set the connection string
body: <p>I am not sure whether it has been disscussed before or not but I have the following code (I changed from example for an Access database.) </p>
  
  <p>I don't know what to put inside the <strong><em>'Provider'</em></strong> and the <strong><em>'Data Source'</em></strong>. I'm using <strong>MS SQL Server 2005</strong> and how to find this information in my machine? Please, even I try to follow from here  <em><a href="http://www.connectionstrings.com/" rel="nofollow noreferrer">http://www.connectionstrings.com/</a></em>, yet I still don't know how to do it.</p>
  
  <p><pre><code>
  Dim conn, sql
  sql = "SELECT * FROM tblOutbox"
  Set conn = CreateObject("ADODB.Connection")
  With conn
        .Provider = "myProvider"
        .Mode = adModeReadWrite
     .ConnectionString = "Data Source=mysource;" &amp; _
            "database=myDbase.mdf;   "
        .Open 
  End With
  If conn.State = adStateOpen Then
        WScript.Echo "Connection was established."
  End If
  conn.Close
  Set conn = Nothing
  </pre></code></p>
  
  <p>here is using access database:
  <pre><code>
  Dim conn 
  Dim sql
  sql = "SELECT * FROM tblOutbox"
  Set conn = CreateObject("ADODB.Connection")
     With conn
        .Provider = "Microsoft.Jet.OLEDB.4.0"
        .Mode = adModeReadWrite
        .ConnectionString = "Data Source= f:/Status.mdb"
        .Open 
     End With
     WScript.Echo "Connection was opened." 
  conn.Close
  Set conn = Nothing
  WScript.Echo "Connection was closed."
  </pre></code></p>