Last post Feb 05, 2013 02:07 PM by anilreddy128
Feb 04, 2013 02:53 PM|Nenson|LINK
I have read most of the threads with this problem, and was searching for a solution everywhere but nothing helped, please just post a solution that I could try to implement. The connection string that i used in Visual Studio 2010 also does not work.
So, I am using Visual Studio Express 2012, the web.confing string is the following (the latest that I have tryed to use):
<add name="myConnectionString" connectionString="Data Source=|DataDirectory|\Database.mdf;Initial Catalog=MyDataBaseName;Integrated Security=True"
string sqlQuery = "SELECT ime FROM Korisnik";
string connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["myConnectionString"].ConnectionString;
SqlConnection sqlcon = new SqlConnection(connectionString);
And finally, the latest error that was thrown:
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)
It's very frustrating, thank you people!
Feb 04, 2013 03:57 PM|anilreddy128|LINK
Provider seems to be a problem here. Try changing it to OLEDB and connect.
for access OleDbConnection should be used, not SqlConnection..........
Feb 05, 2013 12:24 PM|Nenson|LINK
Thank you anilreddy128, I have found a way!
<add name="sqlString" connectionString="Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\Database.mdf;Integrated Security=True"
string dbString = ConfigurationManager.ConnectionStrings["sqlString"].ConnectionString;
SqlConnection dbConn = new SqlConnection(dbString);
Feb 05, 2013 02:07 PM|anilreddy128|LINK
wow... Thats cool.........