本文整理汇总了C#中IDataReader.GetChar方法的典型用法代码示例。如果您正苦于以下问题:C# IDataReader.GetChar方法的具体用法?C# IDataReader.GetChar怎么用?C# IDataReader.GetChar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDataReader
的用法示例。
在下文中一共展示了IDataReader.GetChar方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ColValAsNullableChar
/// <summary>
/// Helper function to return a char column using a supplied column
/// ordinal index from a data reader.
/// </summary>
/// <param name="dr">The data reader.</param>
/// <param name="columnIndex">The ordinal column index.</param>
/// <returns>The date time value of the column or null.</returns>
public static Nullable<char> ColValAsNullableChar(IDataReader dr, int columnIndex)
{
return dr.IsDBNull(columnIndex) ? (Nullable<char>)null : dr.GetChar(columnIndex);
}
示例2: ColValAsChar
/// <summary>
/// Helper function to return a char column using a supplied column
/// ordinal index from a data reader.
/// </summary>
/// <param name="dr">The data reader.</param>
/// <param name="columnIndex">The ordinal column index.</param>
/// <returns>The char value of the column.</returns>
public static char ColValAsChar(IDataReader dr, int columnIndex)
{
return dr.IsDBNull(columnIndex) ? ' ' : dr.GetChar(columnIndex);
}
示例3: Push
internal void Push(CUQueue UQueue, IDataReader dr)
{
int n;
bool bNull;
if (dr == null)
throw new ArgumentNullException("Datarow object can't be null");
if (m_dts == null)
throw new ArgumentNullException("DataTable header is not serialized yet");
if (m_dts.Length != dr.FieldCount)
throw new InvalidOperationException("The size of the input data type array does not match the size of data row");
byte b = 0;
byte bOne = 1;
m_qBit.SetSize(0);
m_qTemp.SetSize(0);
int nLen = m_dts.Length;
for (n = 0; n < nLen; n++)
{
bNull = dr.IsDBNull(n);
if (bNull)
{
b += (byte)(bOne << (byte)(n % 8));
}
if ((n % 8) == 7)
{
m_qBit.Save(b);
b = 0;
}
if (bNull)
continue;
switch (m_dts[n])
{
case tagDataTypeSupported.dtBoolean:
m_qTemp.Save(dr.GetBoolean(n));
break;
case tagDataTypeSupported.dtByte:
m_qTemp.Save(dr.GetByte(n));
break;
case tagDataTypeSupported.dtChar:
m_qTemp.Save(dr.GetChar(n));
break;
case tagDataTypeSupported.dtDateTime:
m_qTemp.Save(dr.GetDateTime(n));
break;
case tagDataTypeSupported.dtDecimal:
m_qTemp.Save(dr.GetDecimal(n));
break;
case tagDataTypeSupported.dtDouble:
m_qTemp.Save(dr.GetDouble(n));
break;
case tagDataTypeSupported.dtFloat:
m_qTemp.Save(dr.GetFloat(n));
break;
case tagDataTypeSupported.dtGuid:
m_qTemp.Save(dr.GetGuid(n));
break;
case tagDataTypeSupported.dtInt16:
m_qTemp.Save(dr.GetInt16(n));
break;
case tagDataTypeSupported.dtInt32:
m_qTemp.Save(dr.GetInt32(n));
break;
case tagDataTypeSupported.dtInt64:
m_qTemp.Save(dr.GetInt64(n));
break;
case tagDataTypeSupported.dtString:
{
string str = dr.GetString(n);
m_qTemp.Save(str);
}
break;
case tagDataTypeSupported.dtBytes:
{
uint nBytes = (uint)dr.GetBytes(n, (long)0, null, 0, 0);
if (m_Buffer == null || nBytes > m_Buffer.Length)
m_Buffer = new byte[nBytes + 1024];
dr.GetBytes(n, (long)0, m_Buffer, 0, (int)nBytes);
m_qTemp.Save(nBytes);
m_qTemp.Push(m_Buffer, nBytes);
}
break;
case tagDataTypeSupported.dtUInt64:
case tagDataTypeSupported.dtUInt32:
case tagDataTypeSupported.dtUInt16:
case tagDataTypeSupported.dtValue:
case tagDataTypeSupported.dtValues:
case tagDataTypeSupported.dtTimeSpan:
{
object obj = dr.GetValue(n);
m_qTemp.Save(obj, false, false);
}
break;
case tagDataTypeSupported.dtUDT:
{
object obj = dr.GetValue(n);
m_qTemp.Save(obj.ToString());
}
break;
default:
throw new InvalidOperationException("Unsupported data type for serialization");
}
//.........这里部分代码省略.........