• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 857
  • Last Modified:

Connection string For SQL Server 2005 Express.

I have started learning about SQL 2005 express.  I quite often populate a list box using the datareader, so this was the first thing I wanted to try. I currently use the following connection strings to connect to SQL 2000, but cannot get them to work with SQL Server Express.

SQL Client:
ConString = "Data Source=;Initial Catalog=myDatabase;User Id=Auser;Password=pwd;"
OLEdb Client:
ConString = "Provider=SQLOleDB; Data Source=;Initial Catalog=MyDatabase;User Id=Auser;Password=pwd;"

Many thanks in advance.

1 Solution
Here is the list of connection strings...


In your program is there any error returned?
If it is a default instance of SQL Express, try this:

SQL Client:
ConString = "Data Source=\SQLEXPRESS;Initial Catalog=myDatabase;User Id=Auser;Password=pwd;"
OLEdb Client:
ConString = "Provider=SQLOleDB; Data Source=\SQLEXPRESS;Initial Catalog=MyDatabase;User Id=Auser;Password=pwd;"
jonesgjAuthor Commented:
Thanks Jack,

I have been here already, but this time I used the attach string :

    Dim constring As String = "Server=.\SQLExpress;AttachDbFilename=" & Application.StartupPath & "\AlphaTest.mdf;Database=AlphaTest;Trusted_Connection=Yes;"

And this worked ....  I must not try to solve problems late at night ....  Thanks again
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.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now