using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Pcb.Common { public static class DataRowExtension { public static int GetInt(this DataRow row, string key) { if (row[key] == null) return 0; var val = row[key].ToString().Trim(); return val == string.Empty ? 0 : int.Parse(val); } public static decimal GetDecimal(this DataRow row, string key) { if (row[key] == null) return 0m; var val = row[key].ToString().Trim(); return val == string.Empty ? 0m : decimal.Parse(val); } /// /// 转化为short类型 /// /// /// /// public static short GetShort(this DataRow row, string key) { if (row[key] == null) return (short)0; var val = row[key].ToString().Trim(); return val == string.Empty ? (short)0 : short.Parse(val); } } }