本文整理汇总了C#中System.GetOrdinal方法的典型用法代码示例。如果您正苦于以下问题:C# System.GetOrdinal方法的具体用法?C# System.GetOrdinal怎么用?C# System.GetOrdinal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System
的用法示例。
在下文中一共展示了System.GetOrdinal方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: populateOrdinals
/// <summary>
/// Permet de stocker l'ordinal à partir du nom du champ/colonne du reader.
/// </summary>
/// <param name="reader">reader contenant les données.</param>
public override void populateOrdinals(System.Data.SqlClient.SqlDataReader reader)
{
ordReponseGuid = reader.GetOrdinal("ID");
ordReponseIntitule = reader.GetOrdinal("Intitule");
ordReponseJuste = reader.GetOrdinal("Juste");
ordReponseQuestionGuid = reader.GetOrdinal("IDQuestion");
}
示例2: getAttachmentFromReader
internal static MessageAttachment getAttachmentFromReader(System.Data.IDataReader rdr, Dictionary<string, bool> columnTable)
{
MessageAttachment attachment = new MessageAttachment();
if (columnTable["ATTACHMENT_ID"])
{
int idIndex = rdr.GetOrdinal("ATTACHMENT_ID");
if (!rdr.IsDBNull(idIndex))
{
attachment.Id = Convert.ToInt32(rdr.GetDecimal(idIndex));
}
}
if (columnTable["ATTACHMENT_NAME"])
{
int nameIndex = rdr.GetOrdinal("ATTACHMENT_NAME");
if (!rdr.IsDBNull(nameIndex))
{
attachment.AttachmentName = rdr.GetString(nameIndex);
}
}
if (columnTable["ATTACHMENT"])
{
int attIndex = rdr.GetOrdinal("ATTACHMENT");
if (!rdr.IsDBNull(attIndex))
{
// not crazy about this implementation as it appears to invoke the reader twice but the commented out code
// block directly below throws an exception when calling GetOracleBlob for some reason... The good thing about
// this solution is it should work for all IDataReader implementations and doesn't need to be cast to an OracleDataReader
byte[] blob = new byte[rdr.GetBytes(attIndex, 0, null, 0, Int32.MaxValue)];
rdr.GetBytes(attIndex, 0, blob, 0, blob.Length);
attachment.SmFile = blob;
//if (rdr is Oracle.DataAccess.Client.OracleDataReader)
//{
// System.Console.WriteLine(rdr[attIndex].GetType().ToString());
// Oracle.DataAccess.Types.OracleBlob blob = ((Oracle.DataAccess.Client.OracleDataReader)rdr).GetOracleBlob(attIndex);
// byte[] buf = new byte[blob.Length];
// blob.Read(buf, 0, Convert.ToInt32(blob.Length));
// attachment.SmFile = buf;
//}
}
}
if (columnTable["MIME_TYPE"])
{
int mimeTypeIndex = rdr.GetOrdinal("MIME_TYPE");
if (!rdr.IsDBNull(mimeTypeIndex))
{
attachment.MimeType = rdr.GetString(mimeTypeIndex);
}
}
if (columnTable["ATTOPLOCK"])
{
int oplockIndex = rdr.GetOrdinal("ATTOPLOCK");
if (!rdr.IsDBNull(oplockIndex))
{
attachment.Oplock = Convert.ToInt32(rdr.GetDecimal(oplockIndex));
}
}
return attachment;
}
示例3: populateOrdinals
/// <summary>
/// Permet de stocker l'ordinal à partir du nom du champ/colonne du reader.
/// </summary>
/// <param name="reader">reader contenant les données.</param>
public override void populateOrdinals(System.Data.SqlClient.SqlDataReader reader)
{
ordMetierGuid = reader.GetOrdinal("ID");
ordMetierNom = reader.GetOrdinal("Nom");
ordMetierFiche = reader.GetOrdinal("Fiche");
ordMetierScoreReseau = reader.GetOrdinal("ScoreReseau");
ordMetierScoreLogiciel = reader.GetOrdinal("ScoreLogiciel");
}
示例4: populateOrdinals
/// <summary>
/// Permet de stocker l'ordinal à partir du nom du champ/colonne du reader.
/// </summary>
/// <param name="reader">reader contenant les données.</param>
public override void populateOrdinals(System.Data.SqlClient.SqlDataReader reader)
{
// GetOrdinal permet d'obtenir la valeur de chaque ordinal par nom de champ/colonne.
// On stocke cette valeur dans nos propriétés.
ordQuestionGuid = reader.GetOrdinal("ID");
ordQuestionIntitule = reader.GetOrdinal("Intitule");
ordQuestionReponseGuid = reader.GetOrdinal("IDReponse");
ordQuestionDifficulteGuid = reader.GetOrdinal("IDDifficulte");
ordQuestionTypeGuid = reader.GetOrdinal("IDType");
}
示例5: ReadValues
/// <summary>
/// Reads the values from an <see cref="IDataRecord"/> and assigns the read values to this
/// object's properties. The database column's name is used to as the key, so the value
/// will not be found if any aliases are used or not all columns were selected.
/// </summary>
/// <param name="source">The object to add the extension method to.</param>
/// <param name="dataRecord">The <see cref="IDataRecord"/> to read the values from. Must already be ready to be read from.</param>
public static void ReadValues(this AllianceTable source, System.Data.IDataRecord dataRecord)
{
System.Int32 i;
i = dataRecord.GetOrdinal("id");
source.ID = (DemoGame.AllianceID)(DemoGame.AllianceID)dataRecord.GetByte(i);
i = dataRecord.GetOrdinal("name");
source.Name = (System.String)(System.String)dataRecord.GetString(i);
}
示例6: ReadValues
/// <summary>
/// Reads the values from an <see cref="IDataRecord"/> and assigns the read values to this
/// object's properties. The database column's name is used to as the key, so the value
/// will not be found if any aliases are used or not all columns were selected.
/// </summary>
/// <param name="source">The object to add the extension method to.</param>
/// <param name="dataRecord">The <see cref="IDataRecord"/> to read the values from. Must already be ready to be read from.</param>
public static void ReadValues(this CharacterTemplateSkillTable source, System.Data.IDataRecord dataRecord)
{
System.Int32 i;
i = dataRecord.GetOrdinal("character_template_id");
source.CharacterTemplateID = (DemoGame.CharacterTemplateID)(DemoGame.CharacterTemplateID)dataRecord.GetUInt16(i);
i = dataRecord.GetOrdinal("skill_id");
source.SkillID = (DemoGame.SkillType)(DemoGame.SkillType)dataRecord.GetByte(i);
}
示例7: ReadValues
/// <summary>
/// Reads the values from an <see cref="IDataRecord"/> and assigns the read values to this
/// object's properties. The database column's name is used to as the key, so the value
/// will not be found if any aliases are used or not all columns were selected.
/// </summary>
/// <param name="source">The object to add the extension method to.</param>
/// <param name="dataRecord">The <see cref="IDataRecord"/> to read the values from. Must already be ready to be read from.</param>
public static void ReadValues(this MapTable source, System.Data.IDataRecord dataRecord)
{
System.Int32 i;
i = dataRecord.GetOrdinal("id");
source.ID = (NetGore.World.MapID)(NetGore.World.MapID)dataRecord.GetUInt16(i);
i = dataRecord.GetOrdinal("name");
source.Name = (System.String)(System.String)dataRecord.GetString(i);
}
示例8: ReadValues
/// <summary>
/// Reads the values from an <see cref="IDataRecord"/> and assigns the read values to this
/// object's properties. The database column's name is used to as the key, so the value
/// will not be found if any aliases are used or not all columns were selected.
/// </summary>
/// <param name="source">The object to add the extension method to.</param>
/// <param name="dataRecord">The <see cref="IDataRecord"/> to read the values from. Must already be ready to be read from.</param>
public static void ReadValues(this ShopItemTable source, System.Data.IDataRecord dataRecord)
{
System.Int32 i;
i = dataRecord.GetOrdinal("item_template_id");
source.ItemTemplateID = (DemoGame.ItemTemplateID)(DemoGame.ItemTemplateID)dataRecord.GetUInt16(i);
i = dataRecord.GetOrdinal("shop_id");
source.ShopID = (NetGore.Features.Shops.ShopID)(NetGore.Features.Shops.ShopID)dataRecord.GetUInt16(i);
}
示例9: ReadValues
/// <summary>
/// Reads the values from an <see cref="IDataRecord"/> and assigns the read values to this
/// object's properties. The database column's name is used to as the key, so the value
/// will not be found if any aliases are used or not all columns were selected.
/// </summary>
/// <param name="source">The object to add the extension method to.</param>
/// <param name="dataRecord">The <see cref="IDataRecord"/> to read the values from. Must already be ready to be read from.</param>
public static void ReadValues(this AppliedPatchesTable source, System.Data.IDataRecord dataRecord)
{
System.Int32 i;
i = dataRecord.GetOrdinal("date_applied");
source.DateApplied = (System.DateTime)(System.DateTime)dataRecord.GetDateTime(i);
i = dataRecord.GetOrdinal("file_name");
source.FileName = (System.String)(System.String)dataRecord.GetString(i);
}
示例10: ReadValues
/// <summary>
/// Reads the values from an <see cref="IDataRecord"/> and assigns the read values to this
/// object's properties. The database column's name is used to as the key, so the value
/// will not be found if any aliases are used or not all columns were selected.
/// </summary>
/// <param name="source">The object to add the extension method to.</param>
/// <param name="dataRecord">The <see cref="IDataRecord"/> to read the values from. Must already be ready to be read from.</param>
public static void ReadValues(this CharacterTemplateQuestProviderTable source, System.Data.IDataRecord dataRecord)
{
System.Int32 i;
i = dataRecord.GetOrdinal("character_template_id");
source.CharacterTemplateID = (DemoGame.CharacterTemplateID)(DemoGame.CharacterTemplateID)dataRecord.GetUInt16(i);
i = dataRecord.GetOrdinal("quest_id");
source.QuestID = (NetGore.Features.Quests.QuestID)(NetGore.Features.Quests.QuestID)dataRecord.GetUInt16(i);
}
示例11: ReadValues
/// <summary>
/// Reads the values from an <see cref="IDataRecord"/> and assigns the read values to this
/// object's properties. The database column's name is used to as the key, so the value
/// will not be found if any aliases are used or not all columns were selected.
/// </summary>
/// <param name="source">The object to add the extension method to.</param>
/// <param name="dataRecord">The <see cref="IDataRecord"/> to read the values from. Must already be ready to be read from.</param>
public static void ReadValues(this AllianceHostileTable source, System.Data.IDataRecord dataRecord)
{
System.Int32 i;
i = dataRecord.GetOrdinal("alliance_id");
source.AllianceID = (DemoGame.AllianceID)(DemoGame.AllianceID)dataRecord.GetByte(i);
i = dataRecord.GetOrdinal("hostile_id");
source.HostileID = (DemoGame.AllianceID)(DemoGame.AllianceID)dataRecord.GetByte(i);
}
示例12: ReadValues
/// <summary>
/// Reads the values from an <see cref="IDataRecord"/> and assigns the read values to this
/// object's properties. The database column's name is used to as the key, so the value
/// will not be found if any aliases are used or not all columns were selected.
/// </summary>
/// <param name="source">The object to add the extension method to.</param>
/// <param name="dataRecord">The <see cref="IDataRecord"/> to read the values from. Must already be ready to be read from.</param>
public static void ReadValues(this ActiveTradeItemTable source, System.Data.IDataRecord dataRecord)
{
System.Int32 i;
i = dataRecord.GetOrdinal("character_id");
source.CharacterID = (DemoGame.CharacterID)(DemoGame.CharacterID)dataRecord.GetInt32(i);
i = dataRecord.GetOrdinal("item_id");
source.ItemID = (DemoGame.ItemID)(DemoGame.ItemID)dataRecord.GetInt32(i);
}
示例13: ReadValues
/// <summary>
/// Reads the values from an <see cref="IDataRecord"/> and assigns the read values to this
/// object's properties. The database column's name is used to as the key, so the value
/// will not be found if any aliases are used or not all columns were selected.
/// </summary>
/// <param name="source">The object to add the extension method to.</param>
/// <param name="dataRecord">The <see cref="IDataRecord"/> to read the values from. Must already be ready to be read from.</param>
public static void ReadValues(this QuestRequireStartQuestTable source, System.Data.IDataRecord dataRecord)
{
System.Int32 i;
i = dataRecord.GetOrdinal("quest_id");
source.QuestID = (NetGore.Features.Quests.QuestID)(NetGore.Features.Quests.QuestID)dataRecord.GetUInt16(i);
i = dataRecord.GetOrdinal("req_quest_id");
source.ReqQuestID = (NetGore.Features.Quests.QuestID)(NetGore.Features.Quests.QuestID)dataRecord.GetUInt16(i);
}
示例14: CheckOrdinals
/// <summary>
/// Prepares the DataObjectDiscription instance to read data from <paramref name="reader"/>
/// use before calling ReadData
/// </summary>
/// <param name="reader"></param>
public void CheckOrdinals(System.Data.IDataReader reader)
{
foreach (FieldAttribute field in EntityDescription.Fields)
{
field.Ordinal = reader.GetOrdinal(field.NameOrAlias);
}
PrimaryKeyFieldAttribute keyField = EntityDescription.Fields.PrimaryKeyField;
if (keyField != null)
{
keyField.Ordinal = reader.GetOrdinal(keyField.NameOrAlias);
}
}
示例15: ReadValues
/// <summary>
/// Reads the values from an <see cref="IDataRecord"/> and assigns the read values to this
/// object's properties. The database column's name is used to as the key, so the value
/// will not be found if any aliases are used or not all columns were selected.
/// </summary>
/// <param name="source">The object to add the extension method to.</param>
/// <param name="dataRecord">The <see cref="IDataRecord"/> to read the values from. Must already be ready to be read from.</param>
public static void ReadValues(this WorldStatsUserShoppingTable source, System.Data.IDataRecord dataRecord)
{
System.Int32 i;
i = dataRecord.GetOrdinal("amount");
source.Amount = (System.Byte)(System.Byte)dataRecord.GetByte(i);
i = dataRecord.GetOrdinal("character_id");
source.CharacterID = (DemoGame.CharacterID)(DemoGame.CharacterID)dataRecord.GetInt32(i);
i = dataRecord.GetOrdinal("cost");
source.Cost = (System.Int32)(System.Int32)dataRecord.GetInt32(i);
i = dataRecord.GetOrdinal("id");
source.ID = (System.UInt32)(System.UInt32)dataRecord.GetUInt32(i);
i = dataRecord.GetOrdinal("item_template_id");
source.ItemTemplateID = (System.Nullable<DemoGame.ItemTemplateID>)(System.Nullable<DemoGame.ItemTemplateID>)(dataRecord.IsDBNull(i) ? (System.Nullable<System.UInt16>)null : dataRecord.GetUInt16(i));
i = dataRecord.GetOrdinal("map_id");
source.MapID = (System.Nullable<NetGore.World.MapID>)(System.Nullable<NetGore.World.MapID>)(dataRecord.IsDBNull(i) ? (System.Nullable<System.UInt16>)null : dataRecord.GetUInt16(i));
i = dataRecord.GetOrdinal("sale_type");
source.SaleType = (System.SByte)(System.SByte)dataRecord.GetSByte(i);
i = dataRecord.GetOrdinal("shop_id");
source.ShopID = (NetGore.Features.Shops.ShopID)(NetGore.Features.Shops.ShopID)dataRecord.GetUInt16(i);
i = dataRecord.GetOrdinal("when");
source.When = (System.DateTime)(System.DateTime)dataRecord.GetDateTime(i);
i = dataRecord.GetOrdinal("x");
source.X = (System.UInt16)(System.UInt16)dataRecord.GetUInt16(i);
i = dataRecord.GetOrdinal("y");
source.Y = (System.UInt16)(System.UInt16)dataRecord.GetUInt16(i);
}