/// <summary>
/// 判断DataReader中是否存在指定列
/// </summary>
/// <param name="dr"></param>
/// <param name="columnName"></param>
/// <returns></returns>
public bool ReaderExists(SqlDataReader dr, string columnName)
{
int count = dr.FieldCount;
for (int i = 0; i < count; i++)
{
if (dr.GetName(i).Equals(columnName))
{
return true;
}
}
return false;
}
转载于:https://www.cnblogs.com/yongtaiyu/p/4975180.html