A
Andrew Smith
Hi,
I am writing an application that will run on a Windows CE
device and hence i am using the .Net compact framework. In
the application, updates get sent from a server to the
client in the form of a DataSet XML Diffgram. This
diffgram is then 'merged' into the clients DataSet (Using
a custom merge method that i have wrote)
This allows the server to tell the CE client what rows it
needs to add/modify and delete. Additions and
modifications are fine because, when reading the Diffgram,
i can access the added and modified row's
DataRow.ItemArray property
However, if a row has been deleted, I can detect that
there is a deleted row in the diffgram DataSet okay, but i
cannot access the row information. I.e. I can't view the
DataRows ItemArray property. Obviously I need this to give
me the primary key which will tell me what row in the
client's DataSet to delete.
The code I'm using is something like the following:
/////////////////////////////////////////////////////////
DataTable sourceTbl = (Some table from the update Diffgram)
DataView deletedRowsDataView = new DataView(sourceTbl);
deletedRowsDataView.RowStateFilter =
DataViewRowState.Deleted;
if (0 != deletedRowsDataView.Count)
{
foreach (DataRowView drv in deletedRowsDataView)
{
try
{
object[] items = drv.Row.ItemArray; // EXCEPTION!
//Use the items array here to delete rows in local
client DataSet
}
catch (Exception e)
{
e.ToString();
}
}
}
/////////////////////////////////////////////////////////
The exception being thrown is of type
DeletedRowInaccessibleException.
Now, in the full .Net Compaact Framework I know you are
supposed to use the following to get at the deleted
version of the row:
object columnValue = drv.Row["ColumnName",
DataRowVersion.Deleted];
However, this method is not supported in the Compact
Framework. So, how do I access the column information for
a deleted Row in the Compact Framework. Or is this even
possible?!
Thanks in advance,
Andrew
I am writing an application that will run on a Windows CE
device and hence i am using the .Net compact framework. In
the application, updates get sent from a server to the
client in the form of a DataSet XML Diffgram. This
diffgram is then 'merged' into the clients DataSet (Using
a custom merge method that i have wrote)
This allows the server to tell the CE client what rows it
needs to add/modify and delete. Additions and
modifications are fine because, when reading the Diffgram,
i can access the added and modified row's
DataRow.ItemArray property
However, if a row has been deleted, I can detect that
there is a deleted row in the diffgram DataSet okay, but i
cannot access the row information. I.e. I can't view the
DataRows ItemArray property. Obviously I need this to give
me the primary key which will tell me what row in the
client's DataSet to delete.
The code I'm using is something like the following:
/////////////////////////////////////////////////////////
DataTable sourceTbl = (Some table from the update Diffgram)
DataView deletedRowsDataView = new DataView(sourceTbl);
deletedRowsDataView.RowStateFilter =
DataViewRowState.Deleted;
if (0 != deletedRowsDataView.Count)
{
foreach (DataRowView drv in deletedRowsDataView)
{
try
{
object[] items = drv.Row.ItemArray; // EXCEPTION!
//Use the items array here to delete rows in local
client DataSet
}
catch (Exception e)
{
e.ToString();
}
}
}
/////////////////////////////////////////////////////////
The exception being thrown is of type
DeletedRowInaccessibleException.
Now, in the full .Net Compaact Framework I know you are
supposed to use the following to get at the deleted
version of the row:
object columnValue = drv.Row["ColumnName",
DataRowVersion.Deleted];
However, this method is not supported in the Compact
Framework. So, how do I access the column information for
a deleted Row in the Compact Framework. Or is this even
possible?!
Thanks in advance,
Andrew