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
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