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. Visual Basic
  4. Updating access database

Updating access database

Scheduled Pinned Locked Moved Visual Basic
helpquestiondatabaseannouncement
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.
  • M Offline
    M Offline
    Mr Oizo
    wrote on last edited by
    #1

    Hi... I have 2 Questions 1.) I have a button which selects mp3 files and then stores their information into a datagrid and then records changes to the database. The problem is that if I look for files outside of the solution folder and select them to be added to the datagridview an error message appears saying that the database could not be found at the specified location(the location they give in the error isn't where the database is supposed to be located in the first place). It works when adding files within the solution folder and any underlying folders within the solution folder but just not outside of this folder. Any ideas why this could be? My 2nd question is that I have various textboxes on a form that when the user selects a row in the datagridview and enters information into these textboxes then the datagridview should be updated. My textboxes are binded directly to the dataset tables columns and my datagridview to the dataset table. It was throwing a concurrency violation error earlier because i called datgridview.update() in the row leave event for the datagridview as well as a call to a sub called saveChanges which is a standard save procedure which checks if there are changes and updates database if there are. Now that I have removed the saveChanges() call from the rowLeave event for the datagridview..... the final row isn't saving changes. My datasets and table adapters are all generated so as far as I know this shoud all be fine? Can Anyone help? Its an access database by the way...my code works fine that I made to add files to the dataset and create a new row etc. Its just the editing that isn't working? Mr Oizo

    G 1 Reply Last reply
    0
    • M Mr Oizo

      Hi... I have 2 Questions 1.) I have a button which selects mp3 files and then stores their information into a datagrid and then records changes to the database. The problem is that if I look for files outside of the solution folder and select them to be added to the datagridview an error message appears saying that the database could not be found at the specified location(the location they give in the error isn't where the database is supposed to be located in the first place). It works when adding files within the solution folder and any underlying folders within the solution folder but just not outside of this folder. Any ideas why this could be? My 2nd question is that I have various textboxes on a form that when the user selects a row in the datagridview and enters information into these textboxes then the datagridview should be updated. My textboxes are binded directly to the dataset tables columns and my datagridview to the dataset table. It was throwing a concurrency violation error earlier because i called datgridview.update() in the row leave event for the datagridview as well as a call to a sub called saveChanges which is a standard save procedure which checks if there are changes and updates database if there are. Now that I have removed the saveChanges() call from the rowLeave event for the datagridview..... the final row isn't saving changes. My datasets and table adapters are all generated so as far as I know this shoud all be fine? Can Anyone help? Its an access database by the way...my code works fine that I made to add files to the dataset and create a new row etc. Its just the editing that isn't working? Mr Oizo

      G Offline
      G Offline
      Guffa
      wrote on last edited by
      #2

      1. Sounds like you are defining the path to the database realtive to the working directory, which changes when you choose a file. Get the application path and use that to specify the path of the database. 2. Dunno.

      --- single minded; short sighted; long gone;

      M 1 Reply Last reply
      0
      • G Guffa

        1. Sounds like you are defining the path to the database realtive to the working directory, which changes when you choose a file. Get the application path and use that to specify the path of the database. 2. Dunno.

        --- single minded; short sighted; long gone;

        M Offline
        M Offline
        Mr Oizo
        wrote on last edited by
        #3

        Hi... I'm not too sure if I understand but I think you mean that my datbase location is not hard coded. I have it set as "dataSource=..\..\data\Accessdatabase.mdb" for the connection string datasource. the reason why i have done it like this is that i need to move my application around to various workstations while i am developing and I was taught that hard coding my connection string(aka using just the generated connection string) is bad practice? So if I am using a relative path and i choose to publish my software will it give me problems and will I only be able to select files from within the project solution folder to add to my datagridview? Mr Oizo

        G 1 Reply Last reply
        0
        • M Mr Oizo

          Hi... I'm not too sure if I understand but I think you mean that my datbase location is not hard coded. I have it set as "dataSource=..\..\data\Accessdatabase.mdb" for the connection string datasource. the reason why i have done it like this is that i need to move my application around to various workstations while i am developing and I was taught that hard coding my connection string(aka using just the generated connection string) is bad practice? So if I am using a relative path and i choose to publish my software will it give me problems and will I only be able to select files from within the project solution folder to add to my datagridview? Mr Oizo

          G Offline
          G Offline
          Guffa
          wrote on last edited by
          #4

          Mr Oizo wrote:

          Hi... I'm not too sure if I understand but I think you mean that my datbase location is not hard coded.

          No, it's because it's relative, so you rely on the working directory. The working directory is changed when you select a file. As I said, get the application directory, and use that as a starting point to reach the database file.

          --- single minded; short sighted; long gone;

          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