SQL Server 2005General 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
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?
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");