Solved

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

Posted on 2013-11-28
4
432 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Microsoft Certification Exam 74-409

VeeamĀ® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
I have a large data set and a SSIS package. How can I load this file in multi threading?
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

691 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