Wrox Programmer Forums
|
SQL Server 2005 General discussion of SQL Server *2005* version only.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 20th, 2007, 09:18 PM
Registered User
 
Join Date: Mar 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default sql express

Hi,
(Im not entirely sure this is the right thread)
Im trying to connect to SQLExpress using a mobile web form.

here is the problem code
****************************************
   string strConn = (@"Data Source=.\\SQLEXPRESS;Database=members;Integrated Security=True;Connect Timeout=30;User Instance=True");

    //Create the SQL Statement
    string strSQL = "select * from members";

    //Create a Connection object
        SqlConnection conn= new SqlConnection(strConn);
        conn.Open();
********************************************

When I run the application I get a debugging error about the conn.Open();.

It says that there is an instance failure.

Ive looked around a fair bit but I cannot find a solution. Has anybody come across this or suggest how to resolve it?

Thanks

dub


 
Old March 21st, 2007, 08:21 AM
Authorized User
 
Join Date: Dec 2006
Posts: 57
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You need to remove the second back slash in the data source name.
string strConn = (@"Data Source=.\SQLEXPRESS;Database=members;Integrated Security=True;Connect Timeout=30;User Instance=True");

Adam Gossage
Lake Wylie, SC, USA





Similar Threads
Thread Thread Starter Forum Replies Last Post
sql express versus sql 2005 ddormody BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 1 July 5th, 2008 02:43 AM
Upgrade SQL Express to SQL Server timeware SQL Server 2005 2 August 27th, 2007 02:37 PM
sql express angelboy C# 2005 2 April 8th, 2007 10:50 AM
Accessing a SQL Server Express DB thru VB Express djelavic SQL Server 2005 2 February 21st, 2006 07:53 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.