Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi all!

 

I have a XML file that is read by a C# program.

The file looks like this:

 

<EMailList>

<email>eduardo.ferrari@misys.com</email>

</EMailList>

<EMailList>

<email>robert.sirard@misys.com</email>

</EMailList>

 

But I want that this file look like this:

 

<EMailList>

<email>eduardo.ferrari@misys.com</email>

<email>robert.sirard@misys.com</email>

</EMailList>

 

But, when I do that my program blows up.

 

The code to read the file is that:

 

public class COpicsXMLOperations

{

 

#region XMLConfigFile

static public DataSet dsOpicsSystemBuilder;

static public DataSet dsOpicsSBUsers;

#endregion

 

static public DataSet DS_OpicsSystemBuilder

{

get

{

if (dsOpicsSystemBuilder==null)

{

dsOpicsSystemBuilder = new DataSet();

 

// Creating EMailList table

DataTable dtEMailList = new DataTable("EMailList");

DataColumn dcEMail = new DataColumn("email");

dtEMailList.Columns.Add(dcEMail);

dsOpicsSystemBuilder.Tables.Add(dtEMailList);

}

return dsOpicsSystemBuilder;

}

}

 

private void FrmProcParam_Load(object sender, System.EventArgs e)

{

// Clear the list to avoid duplicates

clb_EMails.Items.Clear();

this.txt_Emails.Focus();

 

// Read the e-mails against the XML file

COpicsXMLOperations.DS_OpicsSystemBuilder.Tables.Clear();

COpicsXMLOperations.DS_OpicsSystemBuilder.ReadXml("OpicsSystemBuilder.xml"); This is the line that blows up.

 

The error is:

 

An unhandled exception of type 'System.ArgumentException' occurred in system.data.dll

 

Additional information: Cannot remove a table that has existing relations. Remove relations first.

 

The program '[2304] OpicsSystemBuilder.exe' has exited with code 0 (0x0).

 

Anybody can help me with this?

 

Thanks!

 

Eduardo

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...