showing Instance failure when executing connection string in ASP.net (C#)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sangituttu
    New Member
    • Jan 2013
    • 5

    showing Instance failure when executing connection string in ASP.net (C#)

    am already set a connection string in web config file as

    Code:
    <connectionStrings>
    		<add name="con" connectionString="Data Source=ashii\\sqlexpress;Initial Catalog=test;Integrated Security=SSPI" providerName="System.Data.SqlClient"/>
    	</connectionStrings>
    and try to access in code as
    Code:
     SqlConnection con1=new SqlConnection (System.Configuration.ConfigurationManager.ConnectionStrings["con"].ConnectionString);
           
            con1.Open();
    from ths step result is instance failure .How can i solve this
    Last edited by Meetee; Jan 11 '13, 08:15 AM. Reason: use code tags <code/> around code
  • PsychoCoder
    Recognized Expert Contributor
    • Jul 2010
    • 465

    #2
    It sure would help if we knew the exact error message you're getting. I could take a guess but it would be easier if you let us know exactly what it says :)

    Comment

    • sangituttu
      New Member
      • Jan 2013
      • 5

      #3
      its instance failure at the step Con1.open();

      Comment

      • adriancs
        New Member
        • Apr 2011
        • 122

        #4
        Yes, we know where it stopped.
        what is the Error Message? Exception Message?

        Comment

        • monukumar
          New Member
          • Oct 2014
          • 1

          #5
          yes, it shows the exception error which shows the "Instance failure"

          Comment

          • Frinavale
            Recognized Expert Expert
            • Oct 2006
            • 9749

            #6
            With no description about what type of exception you are getting the only thing that I can suggest is:

            Please ensure that your connection string is correct.

            For more information about connection strings please see this MSDN article about Connection String Syntax.

            -Frinny

            Comment

            Working...