Solved

connection string tricky problem, server is remote and I cannot access the version of it.

Posted on 2013-11-28
4
374 Views
Last Modified: 2013-11-28
Hi;

My SqlConnection is causing an error "sqlConn.ServerVersion threw an exception of type System.InvalidOperationException".

<add key="MSSQLConnectionString" value="Server=aa.bb.cc.dd\server,1433;Database=Mydb;User ID=Foo;Password=Baz;Trusted_Connection=False"/>

Open in new window


And the code gives this error is as follows:

 con = new SqlConnection(ConfigurationSettings.AppSettings["MSSQLConnectionString"]);
                con.Open();

Open in new window


What to do?

Regards.
0
Comment
Question by:jazzIIIlove
  • 2
4 Comments
 
LVL 26

Expert Comment

by:tigin44
ID: 39683259
error message?
0
 
LVL 12

Author Comment

by:jazzIIIlove
ID: 39683354
In the question..
0
 
LVL 12

Author Comment

by:jazzIIIlove
ID: 39683365
0
 
LVL 21

Accepted Solution

by:
Tapan Pattanaik earned 500 total points
ID: 39683627
<connectionStrings>
    <add name="3Tier_ConnectionString" providerName="System.Data.SqlClient"
         connectionString="Server=TAPAN;Database=Employee;Uid=Sa;Pwd=tapan"></add>
   
  </connectionStrings>


 string conStr = System.Configuration.ConfigurationManager.ConnectionStrings["3Tier_ConnectionString"].ConnectionString;

SqlConnection con = new SqlConnection(conStr);
            con.Open();
0

Featured Post

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question