c# - Connecting to a database -


i'm trying connect database nothing try works.

sqlconnection conn = new sqlconnection(@"data source=c:\users\gerard foley\desktop\northwind.sdf");  conn.open(); 

no matter try error:

a network-related or instance-specific error occurred while establishing connection sql server. server not found or not accessible. verify instance name correct , sql server configured allow remote connections. (provider: sql network interfaces, error: 26 - error locating server/instance specified)

i stole connection string database explorer -> properties -> connection string. missing? can tables show in datagridview fine (by dragging data sources), want use own ui , queries. can't seem figure ado thing out. using c# express 2010 , sql server express 2008.

for proper connection string use connect sql server have at:

http://connectionstrings.com

the connection string using strange, should contain server name , database name, see link above examples...


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -