本文整理汇总了C#中IDataReader.IsDBNull方法的典型用法代码示例。如果您正苦于以下问题:C# IDataReader.IsDBNull方法的具体用法?C# IDataReader.IsDBNull怎么用?C# IDataReader.IsDBNull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDataReader
的用法示例。
在下文中一共展示了IDataReader.IsDBNull方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MeetingRoom
private MeetingRoom(IDataReader reader)
{
this.Id = reader.GetInt32(0);
this.Name = reader.GetString(1);
this.Capacity = reader.GetInt32(2);
this.Beacon = reader.IsDBNull(3) ? null : reader.GetString(3);
this.Timezone = reader.IsDBNull(4) ? null : reader.GetString(4);
}
示例2: Person
public Person(IDataReader reader)
: this()
{
PersonId = reader.GetInt64(0);
if (!reader.IsDBNull(1))
PersonKey = reader.GetString(1);
if (!reader.IsDBNull(2))
RedirectPersonId = reader.ReadInt64OrNull(2);
if (!reader.IsDBNull(3))
SourceChannelId = reader.GetInt64(3);
if (!reader.IsDBNull(4))
Firstname = reader.GetString(4);
if (!reader.IsDBNull(5))
Lastname = reader.GetString(5);
if (!reader.IsDBNull(6))
DateOfBirth = reader.ReadDateTimeOrNull(6);
if (!reader.IsDBNull(7))
Locale = reader.GetString(7);
if (!reader.IsDBNull(8))
Gender = reader.GetString(8);
if (!reader.IsDBNull(9))
Timezone = reader.GetString(9);
if (!reader.IsDBNull(10))
DateCreated = reader.ReadDateTime(10);
}
示例3: Conversation
public Conversation(IDataReader reader)
: this()
{
ConversationId = reader.GetInt64(0);
if (!reader.IsDBNull(1))
ConversationIdentifier = reader.GetString(1);
if (!reader.IsDBNull(2))
Context = reader.GetString(2);
}
示例4: mCargarTJD
private static ETejeduria_DetMall mCargarTJD(IDataReader rdr)
{
ETejeduria_DetMall oTJ = new ETejeduria_DetMall();
//oTJ.Id_producto = rdr.IsDBNull(rdr.GetOrdinal("id_producto")) ? String.Empty : rdr.GetString(rdr.GetOrdinal("id_producto"));
//oTJ.Nu_correficha = rdr.IsDBNull(rdr.GetOrdinal("nu_correficha")) ? String.Empty : rdr.GetString(rdr.GetOrdinal("nu_correficha"));
oTJ.Nu_secuen = rdr.IsDBNull(rdr.GetOrdinal("nu_secuen")) ? String.Empty : rdr.GetString(rdr.GetOrdinal("nu_secuen"));
oTJ.Nu_item = rdr.IsDBNull(rdr.GetOrdinal("nu_item")) ? String.Empty : rdr.GetString(rdr.GetOrdinal("nu_item"));
oTJ.Nu_longmalla = rdr.IsDBNull(rdr.GetOrdinal("nu_longmalla")) ? 0 : rdr.GetDecimal(rdr.GetOrdinal("nu_longmalla"));
oTJ.St_anulado = rdr.IsDBNull(rdr.GetOrdinal("st_anulado")) ? String.Empty : rdr.GetString(rdr.GetOrdinal("st_anulado"));
return oTJ;
}
示例5: Load
/// <summary>
/// Loads values from a data reader.
/// </summary>
/// <param name="reader">The data reader.</param>
/// <param name="xIndex">The column number of the x-variable.</param>
/// <param name="yIndex">The column number of the y-variable.</param>
public void Load(IDataReader reader, int xIndex, int yIndex)
{
if (reader == null) throw new ArgumentNullException("reader");
if (isReadOnly) throw new InvalidOperationException();
while (reader.Read())
{
if (reader.IsDBNull(xIndex) || reader.IsDBNull(yIndex)) continue;
object xValue = reader.GetValue(xIndex);
object yValue = reader.GetValue(yIndex);
Add(Convert.ToDouble(xValue, CultureInfo.InvariantCulture), Convert.ToDouble(yValue, CultureInfo.InvariantCulture));
}
}
示例6: Group
public Group(IDataReader reader)
{
_id = (int)reader["GroupID"];
if (!reader.IsDBNull(reader.GetOrdinal("GeoLat")))
_geoLatitude = float.Parse(reader["GeoLat"].ToString());
if (!reader.IsDBNull(reader.GetOrdinal("GeoLng")))
_geoLongitude = float.Parse(reader["GeoLng"].ToString());
_name = reader["Name"] as string;
_profile = reader["Profile"] as string;
_postalCode = reader["PostalCode"] as string;
_createdDate = (DateTime)reader["CreatedDate"];
}
示例7: GetMenu
public Menu GetMenu(IDataReader param)
{
_menu = null;
if (param.Read())
{
string id = (!param.IsDBNull(param.GetOrdinal("ID"))) ? (param.GetString(param.GetOrdinal("ID"))) : string.Empty;
string nombre = (!param.IsDBNull(param.GetOrdinal("NOMBRE"))) ? (param.GetString(param.GetOrdinal("NOMBRE"))) : string.Empty;
string nivel = (!param.IsDBNull(param.GetOrdinal("NIVEL"))) ? (param.GetString(param.GetOrdinal("NIVEL"))) : string.Empty;
_menu = NewMenu(id, nombre, nivel);
}
return _menu;
}
示例8: GetColumnInfoFrom
public static ColumnInfo GetColumnInfoFrom(IDataReader reader)
{
string columnName = reader.IsDBNull(0) ? string.Empty : reader.GetString(0);
string dataType = reader.IsDBNull(1) ? string.Empty : reader.GetString(1);
int size = reader.IsDBNull(2) ? 0 : reader.GetInt32(2);
ColumnInfo column = new ColumnInfo(
columnName,
dataType,
size
);
return column;
}
示例9: NullSafeGet
public object NullSafeGet(IDataReader rs, string[] names, object owner)
{
int typeIndex = rs.GetOrdinal(names[0]);
int dataIndex = rs.GetOrdinal(names[1]);
if (rs.IsDBNull(typeIndex) || rs.IsDBNull(dataIndex))
{
return null;
}
var type = (string) rs.GetValue(typeIndex);
var data = (string) rs.GetValue(dataIndex);
return Deserialize(data, type);
}
示例10: GetInspectText
public string GetInspectText(string Location, string objectName, out int viewCount)
{
string[] inspectText = new string[inspectTextVariations];
string returnInspectText = "";
int inspectTextCount = inspectText.Length;
viewCount = new int();
//CLEARS INSPECT TEXT VALUES
for(int i = 0; i < inspectText.Length; i++) inspectText[i] = "";
//GETS INSPECT TEXT FROM DATABASE AND PUTS INTO STRING ARRAY
sqlQuery = "SELECT Id,Name,Inspect_Text,Inspect_Text_Alt,Inspect_Text_Alt_2,Inspect_Text_Type FROM '" + Location + "' WHERE Name Like '" + objectName + "'";
Debug.Log (sqlQuery);
dbcmd.CommandText = sqlQuery;
reader = dbcmd.ExecuteReader();
while (reader.Read ()) {
if(!reader.IsDBNull(2)) inspectText[0] = reader.GetString (2);
if(!reader.IsDBNull(3)) inspectText[1] = reader.GetString (3);
if(!reader.IsDBNull(4)) inspectText[2] = reader.GetString (4);
}
//COUNT FOR EMPTY ARRAYS
for(int i = 0; i < inspectText.Length; i++) {
if(inspectText[i] == "") inspectTextCount--;
}
/*
if(!reader.IsDBNull (5))
inspectType = (InspectType) Enum.Parse(typeof(InspectType), reader.GetString(5));*/
switch(inspectType) {
case InspectType.RANDOM:
int choice = UnityEngine.Random.Range(0, inspectTextCount);
returnInspectText = inspectText[choice];
break;
case InspectType.ORDER:
if(viewCount < inspectTextCount) returnInspectText = inspectText[viewCount];
else returnInspectText = inspectText[inspectText.Length - 1];
break;
case InspectType.ONCE:
if(viewCount < inspectTextCount) returnInspectText = inspectText[viewCount];
else returnInspectText = "";
break;
case InspectType.WAIT:
returnInspectText = inspectText[0];
break;
}
viewCount++;
return returnInspectText;
}
示例11: GetEmployee
private Employee GetEmployee(IDataReader reader)
{
return new Employee(
reader.GetString(reader.GetOrdinal("FirstName")),
reader.GetString(reader.GetOrdinal("LastName")),
reader.GetInt32(reader.GetOrdinal("ReportingScope")),
new ReportingArea(
reader.GetString(reader.GetOrdinal("SDst")),
reader.GetString(reader.GetOrdinal("PA")),
reader.IsDBNull(reader.GetOrdinal("ZoneName")) ? null : reader.GetString(reader.GetOrdinal("ZoneName")),
reader.IsDBNull(reader.GetOrdinal("RegionID")) ? null : (int?)reader.GetInt32(reader.GetOrdinal("RegionID")),
reader.IsDBNull(reader.GetOrdinal("RegionName")) ? null : reader.GetString(reader.GetOrdinal("RegionName")),
(ReportingScope)reader.GetInt32(reader.GetOrdinal("ReportingScope"))));
}
示例12: MeetingRoomBooking
private MeetingRoomBooking(IDataReader reader)
{
this.Id = reader.GetInt32(0);
this.Day = reader.GetInt32(1);
this.From = reader.GetInt32(2);
this.Till = reader.GetInt32(3);
this.Users = reader.GetString(4);
this.meetingRoom = reader.GetInt32(5);
this.UsersNotified = reader.IsDBNull(6) ? false : reader.GetBoolean(6);
if (reader.IsDBNull(7))
this.NotifyUsers = new List<string>();
else
this.NotifyUsers = JsonConvert.DeserializeObject<List<string>>(reader.GetString(7));
this.UsersCheckedIn = reader.IsDBNull(8) ? null : reader.GetString(8);
}
示例13: NullSafeGet
public object NullSafeGet(IDataReader rs, string[] names, object owner)
{
var ordinal = rs.GetOrdinal(names[0]);
if (rs.IsDBNull(ordinal))
return false;
return rs.GetInt32(ordinal) == 1;
}
示例14: CreateInstance
public object CreateInstance(IDataReader reader)
{
if (reader == null)
{
throw new ArgumentNullException("reader");
}
if (log.IsDebug)
{
log.Debug(LogMessages.ObjectInfo_CreatingInstance, forType.Name);
}
var fieldTypes = new Type[reader.FieldCount];
var values = new object[reader.FieldCount];
for (int i = 0; i < reader.FieldCount; i++)
{
fieldTypes[i] = reader.GetFieldType(i);
values[i] = reader.IsDBNull(i) ? null : reader.GetValue(i);
}
var tupleType = GetTupleType(fieldTypes);
var tuple = Activator.CreateInstance(tupleType, values);
return tuple;
}
示例15: getBoolean
protected static bool getBoolean(IDataReader dataReader, int column)
{
if (!dataReader.IsDBNull(column))
return dataReader.GetBoolean(column);
return false;
}