Last post Aug 03, 2012 04:18 PM by barryfz
Jul 06, 2012 09:39 AM|bhetland|LINK
I am using VS.NET 2010 10.0.40219.1 SP1, working on a VB.NET web application, with some TableAdapters (xsd) and ObjectDataSources. The xsd files are all in a folder named "datasources" in the root of the web app.
- When I add a new TableAdapter (referencing any existing stored procedure) that TableAdapter does NOT display in the list of Business Objects when I Configure an existing or a new ObjectDataSource.
- In addition to this, if I update an existing stored procedure (add parameters) and then reconfigure the TableAdapter, the TableAdapter correctly shows the new parameter, the Preview Data feature works as expected, but then after I refresh the ObjectDataSource
and run my app, it gives me an error saying that no generic GetData method exists that matches... (and I've had to change the object datasource tag to reflect the new parameter of the proc), and indeed, when I look at its GetData method, the generated code
has NOT been updated to reflect the new parameter.
- I've tried this on two separate machines, and it fails on both.
WHAT DOES WORK:
- All of what does NOT work, did work fine for years, until I upgraded from VS 2008 to VS 2010.
- The TableAdapters all work fine. I can use the "Preview Data" with them.
- The existing ObjectDataSources (ones that I haven't edited / changed) continue to work fine.
WHAT SEEMS LIKE IS HAPPENING:
- If I understand this correctly, the code that is generated for GetData, is in the DLL of my web app.
- Reflection is used in the ObjectDataSource wizard, to populate the list of Business Objects to choose from.
- But when I add a new TableAdapter, the GetData code/method is NOT being generated. I've even modified existing TableAdapters and specified a custom method name like GetData_Brent and when I search the entire solution for that method, it isn't there.
- In short, it seems like VS.NET is NOT changing / generating the methods to fill / get the data correctly for the TableAdapters, when a new one is added or when an existing one is reconfigured. WHY? The TableAdapter wizard completes successfully.
WHAT I'VE TRIED:
- Closed VS.NET 2010. Searched my ENTIRE hard drive and deleted every version of my web app's DLL. Reopened my solution and before rebuilding, I added a new ObjectDataSource and at that point, there were no Business Objects. That is what I'd expect, since
the web app DLL hadn't been built.
- Then Built the entire Solution and configured the ObjectDataSource. No luck. The new TableAdapters are NOT available in the list of Business Objects. All of the old ones are still there.
- I am using Forms authentication, and one solution I saw was to first set the mode to "None" and then build the solution. Didn't work.
- Tried fiddling with the OldValuesParameterFormatString setting, but that isn't the problem, because again, I don't even see new TableAdapters in my list of Business Objects.
- Set the Hierarchical Update property to True, in the designer. Built the solution. Added a new TableAdapter. Built the solution again. The tableadapter's business object still did not show up in my objectdatasource list.
WHAT IS HAPPENING?
Jul 08, 2012 09:15 PM|Decker Dong - MSFT|LINK
Your situation seems a little strange，So as far as I see，I think you can delete the whole TableAdapter in the VS2010——the upgrated version of solution and then recreate one。
Jul 10, 2012 07:36 AM|bhetland|LINK
Deleting the table adapter wouldn't help...
I've found the answer.
The xsd files have a property named "Custom Tool". When I add a completely new xsd file, that property is set to MSDataSetGenerator. However, the Custom Tool property is blank for all of my existing xsd files.
My projects were previously VS 2008 projects and in the old projects (prior to the VS 2010 migration) that property was also blank. However in VS 2008, modifications to the TableAdapters (and new table adapters) worked just fine. The code was property
created or modified (although it almost seems like the code shouldn't have been modified or created with that property being blank).
In VS 2010 though, with that property blank, no code was generated or modified when I created or modified Table Adapters.
The fix is to:
1. Delete the existing Dataset.designer.vb file.
2. Set the Custom Tool property of the xsd file to: MSDataSetGenerator
A new dataset.designer.vb file will be created and code generation will work from then on.
Hope this helps someone.
Aug 03, 2012 04:18 PM|barryfz|LINK
I had a situation where it was generating a new designer but it was calling it datasetname1.designer.cs. Then I had errors about duplicate stuff and I was deleting this new file and keeping the old one. It was the new one that had my changes in it. I
tried deleting the designer before the rebuild but it still insists on naming it with a 1 on the end. Works ok but seems a little strange. Thanks for posting this.
This is obviously a bug, I hope they have it fixed in vs2012.