I had similar exception many times, that exception occurs usually when you create your dataset using the Drag & Drop functionality in Visual Studio, either dragging your Dataset from the server explorer panel or from a database within your project. and then once you Remove, Rename that referenced Database (or is not accessible anymore for any reason) that exception will occur:
Parser Error Message: Failed to generate code. Exception of type 'System.Data.Design.InternalException' was thrown.
it can be for other reasons but as said that's the common case for me.
How to Solve It:
Now to solve the issue is all you need to do is this:
- Right click your Dataset in the project explorer, choose "Run Custom Tool" and select the Text Editor.
- Once opened your dataset in a text editor, go through it until you find a "Connection" node.
- the "connection" node has a "ConnectionStringObject" attribute that points to the old Database connection string.
- Change that connection string to the appropriate one that works.
- Save your changes, it should work now.