本文整理汇总了C#中System.Data.Odbc.OdbcDataReader.IsDBNull方法的典型用法代码示例。如果您正苦于以下问题:C# OdbcDataReader.IsDBNull方法的具体用法?C# OdbcDataReader.IsDBNull怎么用?C# OdbcDataReader.IsDBNull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Data.Odbc.OdbcDataReader
的用法示例。
在下文中一共展示了OdbcDataReader.IsDBNull方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetNullableDatetime
public static DateTime? GetNullableDatetime(OdbcDataReader reader, string columnName)
{
int x = reader.GetOrdinal(columnName);
return reader.IsDBNull(x) ? (DateTime?)null : reader.GetDateTime(x);
}
示例2: GetUserFromReader
private OpenIdMembershipUser GetUserFromReader(OdbcDataReader reader)
{
string username = reader.GetString(0);
string openId = reader.IsDBNull(1) ? string.Empty : reader.GetString(1);
string email = reader.IsDBNull(2) ? string.Empty : reader.GetString(2);
string passwordQuestion = "";
if (reader.GetValue(3) != DBNull.Value)
passwordQuestion = reader.GetString(3);
string comment = "";
if (reader.GetValue(4) != DBNull.Value)
comment = reader.GetString(4);
bool isApproved = reader.GetBoolean(5);
DateTime creationDate = reader.GetDateTime(6);
DateTime lastLoginDate = new DateTime();
if (reader.GetValue(7) != DBNull.Value)
lastLoginDate = reader.GetDateTime(7);
DateTime lastActivityDate = reader.GetDateTime(8);
DateTime lastPasswordChangedDate = reader.GetDateTime(9);
object providerUserKey = reader.GetValue(10);
bool isLockedOut = reader.GetBoolean(11);
DateTime lastLockedOutDate = new DateTime();
if (reader.GetValue(12) != DBNull.Value)
lastLockedOutDate = reader.GetDateTime(12);
OpenIdMembershipUser u = new OpenIdMembershipUser(
this.Name,
openId,
username,
providerUserKey,
email,
passwordQuestion,
comment,
isApproved,
isLockedOut,
creationDate,
lastLoginDate,
lastActivityDate,
lastPasswordChangedDate,
lastLockedOutDate);
return u;
}
示例3: ReturnString
private string ReturnString(OdbcDataReader dr, int i)
{
if (dr.Read()) {
if (dr.IsDBNull(i)) {
return string.Empty;
} else {
string returnString = dr.GetValue(i).ToString();
return returnString;
}
}
return string.Empty;
}