liye

liye

博客园 首页 新随笔 联系 订阅 管理
DataRow[] DataRows = DsTable.Select("Field1='A'");
  foreach (DataRow dr in DataRows)
  {
  dr[ColumnName] = NewValue;

  }


 

 DataRow dr = dt.NewRow();  //dt是DataTable
dt.Rows.Add(dr);
dt.Rows[dt.Rows.Count
- 1]["列1"] = "111";


foreach (DataRow dr in ((DataView)ugcQuerySettings.DefaultView.DataSource).Table.Rows)
{
foreach(KeyValuePair<String,String>tmpKey in dicName)
{
if (tmpKey.Value == dr.ItemArray[0].ToString())
{
tableName = tmpKey.Key;
}
}
fieldName = dr.ItemArray[1].ToString();
dr["S_TABLENAME"] = tableName;
dr["S_FIELDNAME"] = fieldName;
if (tableName == "TAPP_APPOINTMENT")
{
dr["S_SQL"] = dr["S_SQL"] = string.Format(" " + fieldName + "<={0}+{1} and " + fieldName + ">={0}-{1}", CSharp.OfficeDB.DataBase.DBKind == CSharp.OfficeDB.DatabaseKind.Oracle ? "sysdate" : "getdate()", dr.ItemArray[3].ToString());
}
else
{
dr["S_SQL"] = string.Format(" " + fieldName + ">={0}-" + dr.ItemArray[3].ToString(), CSharp.OfficeDB.DataBase.DBKind == CSharp.OfficeDB.DatabaseKind.Oracle ? "sysdate" : "getdate()");
}
dr["N_DAYS"] = dr.ItemArray[3].ToString();
dtSettings.ImportRow(dr);
}

 

posted on 2010-05-31 15:47    阅读(1185)  评论(0编辑  收藏  举报