Solved

Connection string For SQL Server 2005 Express.

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

by Mark Wills Attending one of Rob Farley's seminars the other day, I heard the phrase "The Accidental DBA" and fell in love with it. It got me thinking about the plight of the newcomer to SQL Server...  So if you are the accidental DBA, or, simp…
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

943 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

10 Experts available now in Live!

Get 1:1 Help Now