using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
namespace CnasSynchronusDAL
{
public class FoxProSpecialDtMethod
{
///
/// 模拟SQL中函数comcat(A,B,C) as D
///
///
///
///
public static DataTable FoxProSpecialDtMethodForComcat(DataTable dt,string strParams)
{
string[] strParamsItems = strParams.Split(new string[] { "{", "}" }, StringSplitOptions.RemoveEmptyEntries);
if (strParamsItems.Length == 2)
{
dt.Columns.Add(strParamsItems[1]); //增加新列
string[] strColumns = strParamsItems[0].Split(','); //获取准备合并的列
if (strColumns.Length > 0)
{
foreach (DataRow dr in dt.Rows)
{
foreach (string columnitem in strColumns)
{
if (dt.Columns.Contains(columnitem))
dr[strParamsItems[1]] = dr[strParamsItems[1]].ToString() + dr[columnitem].ToString();
}
}
}
}
return dt;
}
}
}