I need help.
I use Visual studio 2010 and CSharp try to connect to SQL Server (Developer edition install into my computer)
string conStr = "Data Source=.\\MSSQLSERVER;Initial Catalog=AdventureWorks;Integrated Security=True";
SqlConnection conn = new SqlConnection(conStr);
conn.Open();
but it has error like below.
---------------------
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
-------------------------
I also enable the remote server connection option.
So, please help suggest me if you can.
Thank you
foonMod
Loading
Abhimanyu K VatsaPosted May 2, 2011, 7:48 AM
(i) open the Server Explorer and refresh the databases
(ii) if you get any error at refresh time then most probably your system has some temp. files or say bugs which is creating error
(iii) if database refreshes well then proceed next
(iv) add another .aspx page and switch it in design view
(v) drag the table from db explorer on web form
(vi) it automatically will create a new connectionString in your config file or already exist then override it.
(vii) now use that connectionString name in your apps
hope this helps
natchaya khamkunaPosted May 1, 2011, 2:34 PM
I got it now , Thank anyway..
FoonMod
natchaya khamkunaPosted May 1, 2011, 2:25 PM
Mahesh ChandPosted May 1, 2011, 1:23 PM