?
Solved

Connection string For SQL Server 2005 Express.

Posted on 2007-03-30
3
Medium Priority
?
855 Views
Last Modified: 2013-11-27
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=127.0.0.1;Initial Catalog=myDatabase;User Id=Auser;Password=pwd;"
OLEdb Client:
ConString = "Provider=SQLOleDB; Data Source=127.0.0.1;Initial Catalog=MyDatabase;User Id=Auser;Password=pwd;"

Many thanks in advance.

0
Comment
Question by:jonesgj
3 Comments
 
LVL 15

Accepted Solution

by:
JackOfPH earned 750 total points
ID: 18827995
Here is the list of connection strings...

http://www.connectionstrings.com/?carrier=sqlserver2005

In your program is there any error returned?
0
 
LVL 16

Expert Comment

by:rboyd56
ID: 18828538
If it is a default instance of SQL Express, try this:

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

Author Comment

by:jonesgj
ID: 18828605
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
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

755 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