Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. C# linq to sql default appears

C# linq to sql default appears

Scheduled Pinned Locked Moved C#
csharpdatabasequestionworkspacesql-server
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    classy_dog
    wrote on last edited by
    #1

    In a C# desktop application, I am using linq to sql to connect to a sql server 2008 r2 database. The applicatiion is setup to point to various databases depending upon the value in the app.config file. The problem is code in the *.designer.cs gets overrriden somehow by 'defaults' in the .net problem framework. When this happens the 'using system.configuration' gets removed from the application and the 'default settings' values are used to get the database connection string values. When I notice this problem occurs, I need to do the following: 1. place the 'using system.configuration' code back into *.designer.cs file, 2. change the code so the database connection info is obtained from the app.config file, 3. remove the property settings so the 'default' database connections are not used. Thus can you tell me what is causing this problem to occur and how to solve the problem?

    D 1 Reply Last reply
    0
    • C classy_dog

      In a C# desktop application, I am using linq to sql to connect to a sql server 2008 r2 database. The applicatiion is setup to point to various databases depending upon the value in the app.config file. The problem is code in the *.designer.cs gets overrriden somehow by 'defaults' in the .net problem framework. When this happens the 'using system.configuration' gets removed from the application and the 'default settings' values are used to get the database connection string values. When I notice this problem occurs, I need to do the following: 1. place the 'using system.configuration' code back into *.designer.cs file, 2. change the code so the database connection info is obtained from the app.config file, 3. remove the property settings so the 'default' database connections are not used. Thus can you tell me what is causing this problem to occur and how to solve the problem?

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      You cannot modify the designer files at all. Any code you put in there WILL be overwritten and destroyed. The stuff your'e talking about always goes into your Form.cs files, not the designer files.

      A guide to posting questions on CodeProject[^]
      Dave Kreskowiak

      C 1 Reply Last reply
      0
      • D Dave Kreskowiak

        You cannot modify the designer files at all. Any code you put in there WILL be overwritten and destroyed. The stuff your'e talking about always goes into your Form.cs files, not the designer files.

        A guide to posting questions on CodeProject[^]
        Dave Kreskowiak

        C Offline
        C Offline
        classy_dog
        wrote on last edited by
        #3

        So what you are saying if I place the code in form.cs, then the db connection string values will not be overriden? If so, can you show me some code I can use as a reference?

        D 1 Reply Last reply
        0
        • C classy_dog

          So what you are saying if I place the code in form.cs, then the db connection string values will not be overriden? If so, can you show me some code I can use as a reference?

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          Serisouly?? If you need this kind of help, you REALLY need to pickup a beginners book on C# and work through it. It's no different than if you were putting the same code in the designer file.

          A guide to posting questions on CodeProject[^]
          Dave Kreskowiak

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups