Solved

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

Posted on 2013-11-28
4
362 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

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Join & Write a Comment

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

747 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now