C# - SqlConnection Issue
-
I'm new to C# and use VS Express 2005 and SQL Express 2005. Question: 1. I have added Employee.mdf database via Project->Add new item->SQL database 2. Using the following, but see strange things:
SqlConnection sqlcon = new SqlConnection(connectionstring);
- If I use connectionstring as:"Data Source=.\\SQLEXPRESS;Initial Catalog=Employee;Integrated Security=true; User Instance=True"
I get error like: User domain/user passoword failed! No remote access etc strane errors - If I use connectionstring as:"Data Source=.\\SQLEXPRESS;AttachDbFilename=\"C:\\Documents and Settings\\user\\My Documents\\Visual Studio 2005\\Projects\\MyDatabase\\MyDatabase\\Employee.mdf\";Integrated Security=True;User Instance=True"
Then it works fine! But in every book I see, they give the above 1st case but it does not work for me? Any idea? Is it fine to explicitly using the database path in C# project? -
I'm new to C# and use VS Express 2005 and SQL Express 2005. Question: 1. I have added Employee.mdf database via Project->Add new item->SQL database 2. Using the following, but see strange things:
SqlConnection sqlcon = new SqlConnection(connectionstring);
- If I use connectionstring as:"Data Source=.\\SQLEXPRESS;Initial Catalog=Employee;Integrated Security=true; User Instance=True"
I get error like: User domain/user passoword failed! No remote access etc strane errors - If I use connectionstring as:"Data Source=.\\SQLEXPRESS;AttachDbFilename=\"C:\\Documents and Settings\\user\\My Documents\\Visual Studio 2005\\Projects\\MyDatabase\\MyDatabase\\Employee.mdf\";Integrated Security=True;User Instance=True"
Then it works fine! But in every book I see, they give the above 1st case but it does not work for me? Any idea? Is it fine to explicitly using the database path in C# project? -
To fix the remote access denied errors: http://www.datamasker.com/SSE2005_NetworkCfg.htm[^] When using intergrated security you have setup a user in sql server for your windows username/password?