MicrosoftDocs / azure-docs

Open source documentation of Microsoft Azure
https://docs.microsoft.com/azure
Creative Commons Attribution 4.0 International
10.28k stars 21.46k forks source link

How to access ConnectionString in VBScript? #18817

Closed SunnyYu-98 closed 5 years ago

SunnyYu-98 commented 5 years ago

Hi, how can I access the ConnectionString variable in VBScript?

My app is developed with Classic ASP and hosted on Azure App Services.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Grace-MacJones-MSFT commented 5 years ago

Hi @UIrving, thanks for the feedback! We are currently investigating and will update you shortly.

BryanTrach-MSFT commented 5 years ago

@UIrving The below snippet allowed me to access my DB. I hope this helps.

We will now proceed to close this thread. If there are further questions regarding this matter, please tag me in your reply. We will gladly continue the discussion and we will reopen the issue.

Dim conn , rs, sql, ConnString sql = "SELECT * FROM tblOutbox" Set rs = CreateObject("ADODB.Recordset") Set conn = CreateObject("ADODB.Connection") With conn .Provider = "SQLNCLI" .Mode = adModeReadWrite .ConnectionString = "SERVER=.\SQLExpress;AttachDbFilename=F:\Test2.mdf;Database=Test2.mdf; Trusted_Connection=Yes;" .Open WScript.Echo "Connection was established." End With rs.Open sql,conn If conn.State = adStateOpen Then WScript.Echo "Connection was established." Else WScript.Echo "No Connection ." End If rs.Close Set rs = Nothing conn.Close Set conn = Nothing