How do I get Visual Studio 2010 to refresh my DataSet after I have updated the Database source?
Asked Answered
G

2

7

I have added new columns to an existing MS Access 2010 Database that I have hooked into Visual Studio 2010. After updating the Database, the Data Source window and DataSet do not have the new columns. I looked at answers such as this: Visual Studio DataSet Designer Refresh Tables , but configuring the default query with "SELECT * FROM Reservations" (where it has been suggested that updating the query will cause the table to refresh) hasn't refreshed anything. And the built-in "Refresh" buttons on the Data Sources and Database Explorer windows haven't caught the updates yet (there is also a new table I would like to work with shortly).

How the heck do I (non-programatically) update my DataSet? I have custom bindings and do not want to have to manually re-create those by removing this data source and 're-adding' it. I would rather add some custom bindings for my new fields and keep on working away at this project!

Giggle answered 6/6, 2013 at 16:17 Comment(6)
Don't take this the wrong way, but are you sure the connection is pointed to the modified Access database? It's happened to me.Broker
I won't take it the wrong way. :) And yes, I checked to make sure and it is still pointed to the file I updated. I put it in the same folder as the solution so I wouldn't have a hard time keeping track.Giggle
@MichaelPerrenoud Actually, I added it again as a 'second' data-source to the project just to see what would happen, and that DataSet had the extra columns and the second table. However, it was just a blustery mess so I didn't save the changes...Giggle
@MichaelPerrenoud I am embarrassed to admit that I was one sub-folder off. Projects/ReservationSystem/db.accdb was what I modified... Projects/ReservationSystem/ReservationSystem/db.accdb was where it was pointed. D'oh! At least I know the table query method in the DataSet designer works!Giggle
Consider adding that as the answer to this question and then in two days you can accept it.Broker
Added it with links to an almost duplicate that has the correct answer. I won't delete mine simply because if anyone is having the same problem I am, and they are convinced they are pointed to the right file but nothing is working... they might need to actually paste that path into Explorer and see if the database there is the same size as the one they have been editing!Giggle
G
4

Mine turns out to be close to a duplicate question... See this for the answer (and yes, it is as simple as going through the TableAdapter configuration under the DataSet designer.)

Update DataSet structure in Visual Studio to match new SQL Database Structure

Also, see: http://msdn.microsoft.com/en-us/library/ms171902%28VS.80%29.aspx (How to edit TableAdapters)

... and, as I figured out after nearly losing my mind, I was actually one sub-folder off (meaning there were two copies of the database in my project folder). Projects -> MyProject -> db.accdb, and Projects -> MyProject -> MyProject -> db.accdb. If you're having this issue and querying is NOT working, look VERY closely at the path. VERY CLOSELY. :)

Giggle answered 7/6, 2013 at 14:2 Comment(0)
U
0

In my case, I did add this line:

    Me.NameTableAdapter.Fill(Me.AttendanceDbDataSet1.Name)
Ubiety answered 2/3, 2021 at 6:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.