日期:2014-05-17 浏览次数:20585 次
private Command BuildInsertCommand(string userName, MetaData md, FieldValueCollection fields)
{
StringBuilder sql = new StringBuilder();
sql.AppendFormat("INSERT INTO [{0}]", md.TableName);
List<string> columns = new List<string>();
List<string> param = new List<string>();
foreach (string key in fields.Keys)
{
if (!md.FieldMeteDatas[key].IsAutoIncrement)
{
if (md.FieldMeteDatas[key].ColumnName == "Version")
{
columns.Add("Version");
param.Add("1");
}
else if (md.FieldMeteDatas[key].ColumnName == "AddBy")
{
columns.Add("AddBy");
param.Add(string.Format("'{0}'", userName));
}
else if
。。。。。。。。。。。。。//等等