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. Web Development
  3. ASP.NET
  4. ASP.NET using C# InitConnection() Issue

ASP.NET using C# InitConnection() Issue

Scheduled Pinned Locked Moved ASP.NET
csharpquestionasp-netvisual-studiohelp
3 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.
  • J Offline
    J Offline
    JMirando
    wrote on last edited by
    #1

    I am using the visual studio designer and creating table adapters and strongly typed datasets. The question I have is how to override the InitConnection() method the designer creates for you. I have two connection strings I would want to use (say local and remote). So I want to extend/enhance this method to determine which one it should be using. Any thoughts?

    W 1 Reply Last reply
    0
    • J JMirando

      I am using the visual studio designer and creating table adapters and strongly typed datasets. The question I have is how to override the InitConnection() method the designer creates for you. I have two connection strings I would want to use (say local and remote). So I want to extend/enhance this method to determine which one it should be using. Any thoughts?

      W Offline
      W Offline
      WillemM
      wrote on last edited by
      #2

      No need to override it if you use ASP.NET 2.0, there should be a ConnectionString setting in web.config. Change that and you can either use your local or remote database. In ASP.NET 1.1 you will need to set the ConnectionString property of the connection that is used by the commands of the DataAdapter.

      WM. What about weapons of mass-construction? "What? Its an Apple MacBook Pro. They are sexy!" - Paul Watson My blog

      J 1 Reply Last reply
      0
      • W WillemM

        No need to override it if you use ASP.NET 2.0, there should be a ConnectionString setting in web.config. Change that and you can either use your local or remote database. In ASP.NET 1.1 you will need to set the ConnectionString property of the connection that is used by the commands of the DataAdapter.

        WM. What about weapons of mass-construction? "What? Its an Apple MacBook Pro. They are sexy!" - Paul Watson My blog

        J Offline
        J Offline
        JMirando
        wrote on last edited by
        #3

        I was going to do that, but I was also looking for a programmatic way to do it. Previously, I had made my own custom data layer and included logic for it to determine which environment it was in, local or remote. This way I wouldn't have to update the web.config when I published. I tried to use a partial class, either I didn't do it correctly, or it just didnt work.

        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