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?
 
MMeijerConnect With a Mentor Commented:
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
 
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
 
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.