F
fzl2007
I would like to use a more concise method to do the following:
if (dt.Rows.Count < 3)
{
string expression;
expression = "customerName = 'John'";
DataRow[] foundRows;
// Use the Select method to find all rows matching the filter.
foundRows = dt.Select(expression);
if (foundRows.Length == 0)
{
dt.Rows.Add("John", "0", "0");
}
string expressionq;
expressionq = "customerName = 'Jack'";
DataRow[] foundRowsq;
foundRowsq = dt.Select(expressionq);
if (foundRowsq.Length == 0)
{
dt.Rows.Add("Jack", "0", "0");
}
string expressionr;
expressionr = "customerName = 'Mary'";
DataRow[] foundRowsr;
foundRowsr = dt.Select(expressionr);
if (foundRowsr.Length == 0)
{
dt.Rows.Add("Mary", "0", "0");
}
}
Thanks,
Faye
if (dt.Rows.Count < 3)
{
string expression;
expression = "customerName = 'John'";
DataRow[] foundRows;
// Use the Select method to find all rows matching the filter.
foundRows = dt.Select(expression);
if (foundRows.Length == 0)
{
dt.Rows.Add("John", "0", "0");
}
string expressionq;
expressionq = "customerName = 'Jack'";
DataRow[] foundRowsq;
foundRowsq = dt.Select(expressionq);
if (foundRowsq.Length == 0)
{
dt.Rows.Add("Jack", "0", "0");
}
string expressionr;
expressionr = "customerName = 'Mary'";
DataRow[] foundRowsr;
foundRowsr = dt.Select(expressionr);
if (foundRowsr.Length == 0)
{
dt.Rows.Add("Mary", "0", "0");
}
}
Thanks,
Faye