Question getting added tables to show in existing data source

mrRogers

Well-known member
Joined
Jan 23, 2016
Messages
45
Programming Experience
3-5
I have a .accdb as a data source with numerous tables. I needed to add a table to the db and did not want to disturb all I had done in the data set designer with the data source. I went to the db in the bin/debug in hopes I could insert table and just have it then show in the data source selection. It adds to the .accdb just fine. Is there a way to get the added table to show in the data source. I tried to "refresh" and "edit" but still not included. My fear is if I add the table to the original .accdb and then re-add it as a data source; I will have to recreate all the queries I created in the dataset designer for each table.
 

jmcilhinney

VB.NET Forum Moderator
Staff member
Joined
Aug 17, 2004
Messages
14,148
Location
Sydney, Australia
Programming Experience
10+
There's no point adding it to the working copy of the database, the one in the bin folder, because the project doesn't know about that one. If you want to make changes to schema and/or default data then you need to make those changes to the source file, i.e. the one in your project folder, which you can access from the Solution Explorer. Once that's done, you go to the Data Sources window, right click your existing data source and select the option to reconfigure it. That will re-run the wizard and update the data source with any new tables and columns. If I'm not mistaken, anything that's been deleted from the database will have to be deleted from the DataSet manually.
 

mrRogers

Well-known member
Joined
Jan 23, 2016
Messages
45
Programming Experience
3-5
All that worked. I then drug the table to the project and it created a bound DGV and a Fill statement in the Load event. All looked good except execution quit when it hit the Fill statement. I put a breakpoint below this line and it just opened up a half baked form with no errors and never progressed to the breakpoint. Any ideas on what to look at? could it be the data in the table?
 

jmcilhinney

VB.NET Forum Moderator
Staff member
Joined
Aug 17, 2004
Messages
14,148
Location
Sydney, Australia
Programming Experience
10+
Put a break point on the first line of the Load event handler. Does it get hit? If so, wrap the contents of the method in an exception handler and then you should be able to see what's going wrong.
 

mrRogers

Well-known member
Joined
Jan 23, 2016
Messages
45
Programming Experience
3-5
I used a try block and everything loaded except the DGV in question was empty. This particular table has a field that is an OLE object that I put an excel sheet in. I changed this field to a text field and all works-even outside the try block. Any ideas on why it does not want to bring through the OLE object?
 

mrRogers

Well-known member
Joined
Jan 23, 2016
Messages
45
Programming Experience
3-5
No exception thrown.The DGV was empty with nothing in the fields. Are you saying go into the dataset designer and see what the fill command previews the data as? I have not done that but can try.
 

jmcilhinney

VB.NET Forum Moderator
Staff member
Joined
Aug 17, 2004
Messages
14,148
Location
Sydney, Australia
Programming Experience
10+
Are you saying go into the dataset designer and see what the fill command previews the data as?
No, I'm saying look at the actual contents of the actual DataTable you filled. If you're having trouble with some particular data then you need to look at that data, not some other data. You need to actually debug your code. Put a breakpoint on the line that populates the DataTable and then, when execution breaks, step to the next line and then use the debugging tools that VS provides to examine the contents of the DataTable. You have the Autos, Locals, Watch and Immediate windows, amongst others, to examine the state of your application at any particular stage.
 

mrRogers

Well-known member
Joined
Jan 23, 2016
Messages
45
Programming Experience
3-5
Drilled into these three exceptions in the Auto tab that are associated with this table. Is this helpful? Also ine dataset designer preview data of the fill command gave a red exclamation that referenced it could not load data.

'DirectCast(DirectCast(New System.Collections.ArrayList.ArrayListDebugView(Me._MaintSkills3_28_16DataSet.Tables.List).Items(18), MaintSkills3._28._16._MaintSkills3_28_16DataSet.yrlyTrainingPlanDataTable).planColumn.DataType, System.RuntimeType).DeclaringMethod' threw an exception of type 'System.InvalidOperationException'
'DirectCast(DirectCast(New System.Collections.ArrayList.ArrayListDebugView(Me._MaintSkills3_28_16DataSet.Tables.List).Items(18), MaintSkills3._28._16._MaintSkills3_28_16DataSet.yrlyTrainingPlanDataTable).planColumn.DataType, System.RuntimeType).GenericParameterAttributes' threw an exception of type 'System.InvalidOperationException'
'DirectCast(DirectCast(New System.Collections.ArrayList.ArrayListDebugView(Me._MaintSkills3_28_16DataSet.Tables.List).Items(18), MaintSkills3._28._16._MaintSkills3_28_16DataSet.yrlyTrainingPlanDataTable).planColumn.DataType, System.RuntimeType).GenericParameterPosition' threw an exception of type 'System.InvalidOperationException'
 

mrRogers

Well-known member
Joined
Jan 23, 2016
Messages
45
Programming Experience
3-5
Does the above mean that the an excell table is not a legal conversion in OLE data ?
 

mrRogers

Well-known member
Joined
Jan 23, 2016
Messages
45
Programming Experience
3-5
also when the DGV opens I get a large text box that starts off with Exception in DGV, System Argument Exception: Parameter is not valid... and then goes on for a page. Totally lost with getting the OLE data to show.
 
Top Bottom