Solved

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

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

Suggested Solutions

In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
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…
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

730 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