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

Hi,

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"

conn.open constring


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


Any ideas?






thegunnerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

MMeijerCommented:
'conn.open constring' should be 'conn.open 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.
0
thegunnerAuthor Commented:
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...



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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
thegunnerAuthor Commented:
Hi,

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


Excellent ,cheers.
0
MMeijerCommented:
and the udl tool prevent us from making bad connectionstrings :)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.