Error101_Failed to generate code. Exception of type 'System.Data.Design.InternalException' was thrown._ RRS feed

  • Question

  • User-721935742 posted

    I made some changes to the Ads.xsd, and get the following error:

    Error 101 Failed to generate code. Exception of type 'System.Data.Design.InternalException' was thrown. C:\Documents and Settings\ali\My Documents\Visual Studio 2005\Templates\ProjectTemplates\Visual Web Developer\Classifieds1\App_Code\DAL\Ads.xsd 1 

    Any ideas?

    Wednesday, July 26, 2006 7:57 PM

All replies

  • User-721935742 posted

    btw, i just added a few columns, and changed the connection string.

    here is the complete error:


    Parser Error

    Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

    Parser Error Message: Failed to generate code. Exception of type 'System.Data.Design.InternalException' was thrown.

    Source Error:

    Line 1:  <?xml version="1.0" encoding="utf-8"?>
    Line 2:  <xs:schema id="AdsDataComponent" targetNamespace="uri:AspNet:StarterKits:Classifieds:Data" xmlns:mstns="uri:AspNet:StarterKits:Classifieds:Data" xmlns="uri:AspNet:StarterKits:Classifieds:Data" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" attributeFormDefault="qualified" elementFormDefault="qualified">
    Line 3:    <xs:annotation>

    Source File: /Classifieds1/App_Code/DAL/Ads.xsd    Line: 1

    Thursday, July 27, 2006 10:34 AM
  • User-1044770838 posted

    Getting same error. Not sure what is causing it. I created the DataSet yesterday and added a few tableadapters to it. Now today I get his message.

    Friday, July 27, 2007 12:53 PM
  • User730446648 posted

    Is this the first time you've added any columns?

    And did you modify the actual code in the ads.xsd file? (There's hidden code that makes it work)

    Such as insertad, updatead relistad, all in the Ads.xsd code file.


    Sunday, July 29, 2007 1:57 PM
  • User-1883453501 posted

    I've had the exact same problem pop up on me over the years, and today I finally found out the cause.  If you initially created the datasets by dragging and dropping from the Database or Server Explorer inside of Visual Studio, and the database reference at some point is no longer valid (moved/deleted the database), it will cause this exception.

    It's due to the fact that Visual Studio stores the connection string within the XSD.  If that connection string is no longer valid, it can't dynamically generate the needed adapters.  To fix this, change the ConnectionStringObject attribute on the Connection node inside the XSD file (not at design level, but at the text editor level.)  Set it to a valid connection string pointing to the database your dataset corresponds to, and you're good to go.  Just right click on your dataset in the Solution Explorer, and click "Run Custom Tool", and your problem should be fixed.

    Hope this helps everyone else who is frustrated by this error message.


    Thursday, September 20, 2007 9:22 AM
  • User-641918402 posted

     I tried putting the connection string in the ConnectionStringObject but I still get this error.  Any other ideas?

    I developed the site using my localhost db, but now I've changed all connection strings in the project (even in web.config) to the production db.  Any idea why I'm still getting this same error?


    Monday, October 20, 2008 5:07 PM
  • User1879772900 posted
    I got the same problem when I move the website from one network to the another as I have 3 cn strings and I had to rename one of my cn string on the dev server. I got it fixed by adding a dummy TableAdpater --so you can verify you connection string and create a new connection if you don't see the connection you had before. You can also right-click the DAL to bring up context menu, select 'View code' to compare the

    <Connections />

     code before and after making the change.

     Hope this helps.


    Monday, October 27, 2008 5:44 PM
  • User-628859359 posted

     well i had this problem too. Mine was an asp.net 2.0 web application using mysql as backend and i was using a dataset (with .xsd extension) to generate crystal reports . i cud solve this parser error problem in two ways:

    1) I installed mysql.net connector on the machine u want to deploy on but this works if the connection string in ur dataset is valid. 

    2) or while making the dataset just dont drag the table from the server explorer as that would make the connection string.. make the dataset manually so this way a connection string wont come and populate the dataset at runtime with your own connection string ...and it worked

    Thursday, June 25, 2009 2:34 AM
  • User-13655717 posted

     Al reinstalar VS2005, y asumir que se usara el conector ya previamente instalado ocaciona este error,

    La solucion es reinstalar el conector de MySql.

    Wednesday, September 30, 2009 4:42 PM
  • User-709920060 posted

    Oh, thank you! thank you! thank you!  HTPC2Good4U!


    This was irritating me all over the place and would only show up when I tried to create a new table.  Basically, I had the Oracle components installed from their site and had the tables defined in VS 2005 on an XP machine.  When that machine had issues and was upgraded to Win7 where VS2005 SP1 was installed, this was causing me all sorts of headaches.


    All I did was to follow your advice and remove the connection string from the XSD file using Notepad, then did the "Run Custom Control" option and I'm back up now.





    Thursday, June 30, 2011 6:31 PM