using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Data; namespace Bowin.Common.Data { public static class DataRowEx { /// /// 获取指定列的值,并去掉两端的空格 /// /// /// 列名 /// public static string GetValue(this DataRow dr, string colName) { if (dr != null && dr[colName] != null) { return dr[colName].ToString().Trim(); } else { return string.Empty; } } /// /// 获取指定列的值,并去掉两端的空格 /// /// /// 列的索引 /// public static string GetValue(this DataRow dr, int index) { if (dr != null && dr[index] != null) { return dr[index].ToString().Trim(); } else { return string.Empty; } } } }