Solved

Connection string For SQL Server 2005 Express.

Posted on 2007-03-30
3
827 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 250 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
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 use and create keystrokes in Netbeans IDE 8.0 for Windows.

706 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

20 Experts available now in Live!

Get 1:1 Help Now