VWD2008 express + classic asp + connnection string to SQL Server 2008 express

Posted on 2008-11-15
Last Modified: 2013-11-27

I'm creating an few clasic asp pages and I wan to connect to a SQL Server 2008 express database.

I'm using Visual Web Developer 2008 express, and I've tried

set conn = server.CreateObject("ADODB.Connection")
set rs = server.CreateObject("ADODB.Recordset")

connstring = "Provider=GARRY-PC\SQLEXPRESS;Initial Catalog=myDatabase;Persist Security Info=True;User ID=sa;Password=mypassword" constring

...but the page is failing to load. I can see the database open in the database explorer....

Any ideas?

Question by:thegunner
    LVL 5

    Expert Comment

    ' constring' should be ' connstring' :)

    you can test connectionstrings by putting one into a textfile saved with the .udl extension after double clicking it a connectionstring util pops up with a 'test connection' button.

    Author Comment

    Hi, sorry  that was just a typo when writing the question. It doesn't connect with connstring'

    I've tried connecting via a .udl file but doesn;t seem to be working. I wonder if this is becasue it's an express version.

    I can see the database when connecting when viwing through Management Studio...

    LVL 5

    Accepted Solution

    the connectionstring isn't correct, try making one with the udl tool.
    or try replacing the following
    Provider=SQLOLEDB.1; Data Source=GARRY-PC\SQLEXPRESS;

    Author Comment


    Yes add this worked!   Provider=SQLOLEDB.1; Data Source=GARRY-PC\SQLEXPRESS;

    Excellent ,cheers.
    LVL 5

    Expert Comment

    and the udl tool prevent us from making bad connectionstrings :)

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    Join & Write a Comment

    Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
    In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
    This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA.…
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now