Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Can't connect to local instance of SQLEXPRESS

Author  Topic 

wassteve
Starting Member

3 Posts

Posted - 2011-05-13 : 08:22:48
Hi

Hope someone can help.

Brand new to SQL - am trying to connect to a local instance of Sqlexpress 2008R2 from VBA (excel 2007).

I'm using the connection string

"PROVIDER=SQLOLEDB;DATA SOURCE=(local);INITIAL CATALOG=crashcourse; INTEGRATED SECURITY=sspi;"

where my database is called crashcourse

I can connect to this from Ms SQL server management studio where the server name is

Steve-Ultimate\SQLEXPRESS

and the connection is called

Steve-Ultimate\Steve

Tried all combinations of replacing local with Steve-Ultimate, Steve-Ultimate\Steve, Steve-Ultimate\SQLEXPRESS, Steve-Ultimate\Steve\SQLEXPRESS but with all of them I get the error

"SQL Server does not exist or failed to connect"

Any ideas?

Steve

tmaiden
Yak Posting Veteran

86 Posts

Posted - 2011-05-13 : 10:24:44
Try

Data Source=local\SQLEXPRESS;Initial Catalog=crashcourse;Integrated Security=SSPI;
Go to Top of Page

tmaiden
Yak Posting Veteran

86 Posts

Posted - 2011-05-13 : 10:28:04
Also look at http://www.connectionstrings.com/sql-server-2008
Go to Top of Page

wassteve
Starting Member

3 Posts

Posted - 2011-05-13 : 16:37:03
Thanks but have tried both of those....

Steve
Go to Top of Page

wassteve
Starting Member

3 Posts

Posted - 2011-05-13 : 17:18:09
Found the answer....

The local part is

(local)\SQLEXPRESS

placing of the brackets is crucial

S
Go to Top of Page
   

- Advertisement -