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. Database & SysAdmin
  3. Database
  4. Override Stored Connection String

Override Stored Connection String

Scheduled Pinned Locked Moved Database
helpcsharpdatabasevisual-studioquestion
4 Posts 3 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
    chrisace
    wrote on last edited by
    #1

    I have a Windows application that uses typed datasets. When setting up the datasets, Visual Studio asks if you want to remember the connection. This is helpful when making changes to the datatables or table adapters. Before filling the dataset, I programatically change the connection string of each table adapter so that it will connect to the remote database. Before this operation, it is set to the local database since that is the one I am developing on. All goes well except with one form. See the sequence of events below: First I change the connection string. Me.LocationsTableAdapter.Connection.ConnectionString = Database.gdbRemoteConnection.ConnectionString When calling the following fill method, it works as it should. Me.LocationDataTableAdapter.FillByLocationID(Me.DsLocations.LocationData, cmbTestLocation.SelectedValue) When calling the following fill method, it displays an error message saying the database location is not correct. It is referencing the local database even though I changed the connection string. Me.LocationDataTableAdapter.FillByEntryDate(Me.DsLocations.LocationData, dtmDateFrom.Value.Date, dtmDateTo.Value.Date) If I step through the code, it even shows the connection string set to the remote database when the fill method is called. Is this a known bug?

    M F 2 Replies Last reply
    0
    • C chrisace

      I have a Windows application that uses typed datasets. When setting up the datasets, Visual Studio asks if you want to remember the connection. This is helpful when making changes to the datatables or table adapters. Before filling the dataset, I programatically change the connection string of each table adapter so that it will connect to the remote database. Before this operation, it is set to the local database since that is the one I am developing on. All goes well except with one form. See the sequence of events below: First I change the connection string. Me.LocationsTableAdapter.Connection.ConnectionString = Database.gdbRemoteConnection.ConnectionString When calling the following fill method, it works as it should. Me.LocationDataTableAdapter.FillByLocationID(Me.DsLocations.LocationData, cmbTestLocation.SelectedValue) When calling the following fill method, it displays an error message saying the database location is not correct. It is referencing the local database even though I changed the connection string. Me.LocationDataTableAdapter.FillByEntryDate(Me.DsLocations.LocationData, dtmDateFrom.Value.Date, dtmDateTo.Value.Date) If I step through the code, it even shows the connection string set to the remote database when the fill method is called. Is this a known bug?

      M Offline
      M Offline
      Mycroft Holmes
      wrote on last edited by
      #2

      You might be better asking this in the VB forum, Dave Kreskowiak may be able to help, he seems to know how these bloody MS wizard tools seem to work.

      Never underestimate the power of human stupidity RAH

      1 Reply Last reply
      0
      • C chrisace

        I have a Windows application that uses typed datasets. When setting up the datasets, Visual Studio asks if you want to remember the connection. This is helpful when making changes to the datatables or table adapters. Before filling the dataset, I programatically change the connection string of each table adapter so that it will connect to the remote database. Before this operation, it is set to the local database since that is the one I am developing on. All goes well except with one form. See the sequence of events below: First I change the connection string. Me.LocationsTableAdapter.Connection.ConnectionString = Database.gdbRemoteConnection.ConnectionString When calling the following fill method, it works as it should. Me.LocationDataTableAdapter.FillByLocationID(Me.DsLocations.LocationData, cmbTestLocation.SelectedValue) When calling the following fill method, it displays an error message saying the database location is not correct. It is referencing the local database even though I changed the connection string. Me.LocationDataTableAdapter.FillByEntryDate(Me.DsLocations.LocationData, dtmDateFrom.Value.Date, dtmDateTo.Value.Date) If I step through the code, it even shows the connection string set to the remote database when the fill method is called. Is this a known bug?

        F Offline
        F Offline
        Frank Kerrigan
        wrote on last edited by
        #3

        You could always try and not using wizard and program it yourself, at first its hard but it gets easier as you go along.

        DEVELOPER DAY SCOTLAND 2009 Watch this space http://www.developerdayscotland.com/[^]

        C 1 Reply Last reply
        0
        • F Frank Kerrigan

          You could always try and not using wizard and program it yourself, at first its hard but it gets easier as you go along.

          DEVELOPER DAY SCOTLAND 2009 Watch this space http://www.developerdayscotland.com/[^]

          C Offline
          C Offline
          chrisace
          wrote on last edited by
          #4

          Here is the solution as untyped datasets were not an option. http://kmccaa.blogspot.com/2007/07/how-to-move-typed-dataset-to-its-own_11.html[^]

          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