Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Expression Column Workarounds

0 views
Skip to first unread message

Mario T. Lanza

unread,
Apr 14, 2003, 8:47:55 PM4/14/03
to
I have a strongly-typed dataset that includes 3 expression columns.
Problem is, there is a known Microsoft bug that is thrown when
attempting to save a table having expression columns via a
DataAdapter. I don't recollect the error off hand, but I researched
it in the microsoft.public.dotnet.* newsgroups and have determined
that it is not easily avoided.

To avoid this bug, I remove the expression columns (see code below)
from the DataTable prior to saving the data. This miniscule task
takes about 2 seconds. 2 seconds may not seem like much, but it is.

public void RemoveExpressionColumns()
{
try
{
if (this.transactionLineTable.Columns.Contains("LineNo"))
this.transactionLineTable.Columns.Remove(this.lineNoColumn);
if (this.transactionLineTable.Columns.Contains("Sign"))
this.transactionLineTable.Columns.Remove(this.signColumn);
if (this.transactionLineTable.Columns.Contains("Difference"))
this.transactionLineTable.Columns.Remove(this.differenceColumn);
}
catch(Exception ex)
{
System.Windows.Forms.MessageBox.Show("RemoveExpressionColumns:\r\n"
+ ex.ToString());
}
}

Has anyone else overcome the expression column issue in another way?
Any suggestions?

I suppose I could catch the RowChanged event, and calculate the
expressions using code and directly update the so-called expression
columns...?

Mario T. Lanza
Clarity Information Architecture, Inc.

0 new messages