I have DataSetand reading data from two sources. One table from an XML file and another table from a Firebird SQL database. What I'm trying to get is only one table, in which there are all columns from the XML file and several fields from SQL data in one table. Both tables have the same unique key field, so it can be easily merged. I would like to bind all the fields of this table to the fields of the form.
Is this possible, as described, or I don’t see that there is a simpler solution to my problem?
Edit : To show that I'm trying to make some extra code.
DataSet dataSet = new DataSet();
DataTable table1 = new DataTable("test1", "test1");
table1.Columns.Add("id");
table1.Columns.Add("name");
table1.Columns[0].Unique = true;
table1.Rows.Add(new object[2] { 1, "name1" });
table1.Rows.Add(new object[2] { 2, "name2" });
DataTable table2 = new DataTable("test2", "test2");
table2.Columns.Add("id");
table2.Columns.Add("thing");
table2.Columns[0].Unique = true;
table2.Rows.Add(new object[2] { 1, "thing1" });
table2.Rows.Add(new object[2] { 2, "thing2" });
dataSet.Tables.Add(table1);
dataSet.Tables[0].Merge(table2, false);
, ConstraintException. id, , table1 table2. ?
2:
PrimaryKey, .
xmlData.Tables[0].PrimaryKey = new[] { xmlData.Tables[0].Columns["usnr"] };
dbData.PrimaryKey = new[] { dbData.Columns["usid"] };
xmlData.Tables[0].Merge(dbData, true, MissingSchemaAction.Add);
xmlData - DataSet, XML. id, usnr . dbData - DataTable, db id, usid, . id . usnr usid , GetType().
xmlData.Tables[0].Merge(dbData, true, MissingSchemaAction.Add);, DataException
<target>.ID and <source>.ID have conflicting properties: DataType property mismatch.
, id, , , , primaryIey . NullReferenceException . , ?