当前位置: 首页>>代码示例>>C#>>正文


C# System.IsDBNull方法代码示例

本文整理汇总了C#中System.IsDBNull方法的典型用法代码示例。如果您正苦于以下问题:C# System.IsDBNull方法的具体用法?C# System.IsDBNull怎么用?C# System.IsDBNull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System的用法示例。


在下文中一共展示了System.IsDBNull方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: 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;
        }
开发者ID:ChristopherEdwards,项目名称:MDWS,代码行数:60,代码来源:MessageAttachment.cs

示例2: ORM_CreateProxy

 private static hierarchy2b ORM_CreateProxy(System.Data.IDataReader result, System.Collections.Generic.IDictionary<string, int> ordinals)
 {
     return new hierarchy2b()
     {
         pid = result.IsDBNull(ordinals["pid"]) ? 0 : result.GetInt64(ordinals["pid"]),
         fid = result.IsDBNull(ordinals["fid"]) ? 0 : result.GetInt64(ordinals["fid"]),
         textfield = result.IsDBNull(ordinals["textfield"]) ? null : result.GetString(ordinals["textfield"])
     };
 }
开发者ID:lmsoftgithub,项目名称:open-net-orm,代码行数:9,代码来源:hierarchy2b.cs

示例3: populateDTO

        /// <summary>
        /// Permet remplir les propriétés de mappage de l'entité admin.
        /// </summary>
        /// <param name="reader">reader contenant les données.</param>
        /// <returns>Un objet adminDTO.</returns>
        public override Mappage.DTOBase populateDTO(System.Data.SqlClient.SqlDataReader reader)
        {
            typeDTO type = new typeDTO();

            if (!reader.IsDBNull(ordTypeGuid)) { type.typeGuid = reader.GetGuid(ordTypeGuid); }
            if (!reader.IsDBNull(ordTypeType)) { type.typeType = reader.GetString(ordTypeType); }

            type.isNew = false;
            return type;
        }
开发者ID:ZRizzen,项目名称:Projet.net,代码行数:15,代码来源:DTOParserType.cs

示例4: populateDTO

        /// <summary>
        /// Permet de remplir les propriétés de mappage de l'entité difficulté.
        /// </summary>
        /// <param name="reader">reader contenant les données.</param>
        /// <returns>Un objet difficulteDTO</returns>
        public override Mappage.DTOBase populateDTO(System.Data.SqlClient.SqlDataReader reader)
        {
            difficulteDTO difficulte = new difficulteDTO();

            if (!reader.IsDBNull(ordDifficulteGuid)) { difficulte.difficulteGuid = reader.GetGuid(ordDifficulteGuid); }
            if (!reader.IsDBNull(ordDifficulteNiveau)) { difficulte.difficulteNiveau = reader.GetString(ordDifficulteNiveau); }

            difficulte.isNew = false;
            return difficulte;
        }
开发者ID:ZRizzen,项目名称:Projet.net,代码行数:15,代码来源:DTOParserDifficulte.cs

示例5: PopulateDTO

 public override DTOBase PopulateDTO(System.Data.IDataReader reader)
 {
     var credential = base.PopulateId(reader, new Credential());
     if (!reader.IsDBNull(_ordinals.EmailAddress)) { credential.EmailAddress = reader.GetString(_ordinals.EmailAddress); }
     if (!reader.IsDBNull(_ordinals.Salt)) { credential.Salt = reader.GetString(_ordinals.Salt); }
     if (!reader.IsDBNull(_ordinals.PasswordHash)) { credential.PasswordHash = reader.GetString(_ordinals.PasswordHash); }
     if (!reader.IsDBNull(_ordinals.CreateDateTimeUtc)) { credential.CreateDateTimeUtc = reader.GetDateTime(_ordinals.CreateDateTimeUtc); }
     credential.IsNew = false;
     return credential;
 }
开发者ID:mysticode,项目名称:Mystic,代码行数:10,代码来源:CredentialParser.cs

示例6: populateDTO

        /// <summary>
        /// Permet de remplir les propriétés de mappage de l'entité highscore.
        /// </summary>
        /// <param name="reader">reader contenant les données.</param>
        /// <returns>Un objet adminDTO.</returns>
        public override Mappage.DTOBase populateDTO(System.Data.SqlClient.SqlDataReader reader)
        {
            highscoreDTO highscore = new highscoreDTO();

            if (!reader.IsDBNull(ordHighscoreGuid)) { highscore.highscoreGuid = reader.GetGuid(ordHighscoreGuid); }
            if (!reader.IsDBNull(ordHighscorePseudo)) { highscore.highscorePseudo = reader.GetString(ordHighscorePseudo); }
            if (!reader.IsDBNull(ordHighscoreScore)) { highscore.highscoreScore = reader.GetInt32(ordHighscoreScore); }

            highscore.isNew = false;
            return highscore;
        }
开发者ID:ZRizzen,项目名称:Projet.net,代码行数:16,代码来源:DTOParserHighscore.cs

示例7: populateDTO

        /// <summary>
        /// Permet remplir les propriétés de mappage de l'entité admin.
        /// </summary>
        /// <param name="reader">reader contenant les données.</param>
        /// <returns>Un objet adminDTO.</returns>
        public override Mappage.DTOBase populateDTO(System.Data.SqlClient.SqlDataReader reader)
        {
            adminDTO admin = new adminDTO();

            if (!reader.IsDBNull(ordAdminGuid)) { admin.adminGuid = reader.GetGuid(ordAdminGuid); }
            if (!reader.IsDBNull(ordAdminLogin)) { admin.adminLogin = reader.GetString(ordAdminLogin); }
            if (!reader.IsDBNull(ordAdminPassword)) { admin.adminPassword = reader.GetString(ordAdminPassword); }

            admin.isNew = false;
            return admin;
        }
开发者ID:ZRizzen,项目名称:Projet.net,代码行数:16,代码来源:DTOParserAdmin.cs

示例8: populateDTO

        /// <summary>
        /// Permet remplir les propriétés de mappage de l'entité réponse.
        /// </summary>
        /// <param name="reader">reader contenant les données.</param>
        /// <returns>Un objet reponseDTO.</returns>
        public override Mappage.DTOBase populateDTO(System.Data.SqlClient.SqlDataReader reader)
        {
            reponseDTO reponse = new reponseDTO();

            if (!reader.IsDBNull(ordReponseGuid)) { reponse.reponseGuid = reader.GetGuid(ordReponseGuid); }
            if (!reader.IsDBNull(ordReponseIntitule)) { reponse.reponseIntitule = reader.GetString(ordReponseIntitule); }
            if (!reader.IsDBNull(ordReponseJuste)) { reponse.reponseJuste = reader.GetBoolean(ordReponseJuste); }
            if (!reader.IsDBNull(ordReponseQuestionGuid)) { reponse.reponseQuestionGuid = reader.GetInt32(ordReponseQuestionGuid); }

            reponse.isNew = false;
            return reponse;
        }
开发者ID:ZRizzen,项目名称:Projet.net,代码行数:17,代码来源:DTOParserReponse.cs

示例9: populateDTO

        /// <summary>
        /// Permet remplir les propriétés de mappage de l'entité métier.
        /// </summary>
        /// <param name="reader">reader contenant les données.</param>
        /// <returns>Un objet metierDTO.</returns>
        public override Mappage.DTOBase populateDTO(System.Data.SqlClient.SqlDataReader reader)
        {
            metierDTO metier = new metierDTO();

            if (!reader.IsDBNull(ordMetierGuid)) { metier.metierGuid = reader.GetGuid(ordMetierGuid); }
            if (!reader.IsDBNull(ordMetierNom)) { metier.metierNom = reader.GetString(ordMetierNom); }
            if (!reader.IsDBNull(ordMetierFiche)) { metier.metierFiche = reader.GetString(ordMetierFiche); }
            if (!reader.IsDBNull(ordMetierScoreReseau)) { metier.metierScoreReseau = reader.GetInt32(ordMetierScoreReseau); }
            if (!reader.IsDBNull(ordMetierScoreLogiciel)) { metier.metierScorelogiciel = reader.GetInt32(ordMetierScoreLogiciel); }

            metier.isNew = false;
            return metier;
        }
开发者ID:ZRizzen,项目名称:Projet.net,代码行数:18,代码来源:DTOParserMetier.cs

示例10: populateDTO

        /// <summary>
        /// Permet de remplir les propriétés de mappage de l'entité question.
        /// </summary>
        /// <param name="reader">reader contenant les données.</param>
        /// <returns>Un objet questionDTO.</returns>
        public override Mappage.DTOBase populateDTO(System.Data.SqlClient.SqlDataReader reader)
        {
            questionDTO question = new questionDTO(); // On crée un nouveau questionDTO. Etant donné qu'il hérite de DTOBase on peut l'utiliser comme valeur de retour.

            // On utilise l'ordinal correspondant pour s'assurer que la valeur retournée par le reader n'est pas null.
            // Si cette valeur n'est pas null, on utilise getXXX typée du reader pour obtenir la valeur.
            if (!reader.IsDBNull(ordQuestionGuid)) { question.questionGuid = reader.GetGuid(ordQuestionGuid); }
            if (!reader.IsDBNull(ordQuestionIntitule)) { question.questionIntitule = reader.GetString(ordQuestionIntitule); }
            if (!reader.IsDBNull(ordQuestionReponseGuid)) { question.questionReponseGuid = reader.GetInt32(ordQuestionReponseGuid); }
            if (!reader.IsDBNull(ordQuestionDifficulteGuid)) { question.questionDifficulteGuid = reader.GetInt32(ordQuestionDifficulteGuid); }
            if (!reader.IsDBNull(ordQuestionTypeGuid)) { question.questionTypeGuid = reader.GetInt32(ordQuestionTypeGuid); }

            question.isNew = false;
            return question;
        }
开发者ID:ZRizzen,项目名称:Projet.net,代码行数:20,代码来源:DTOParserQuestion.cs

示例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 AccountBanTable source, System.Data.IDataRecord dataRecord)
{
System.Int32 i;

i = dataRecord.GetOrdinal("account_id");

source.AccountID = (DemoGame.AccountID)(DemoGame.AccountID)dataRecord.GetInt32(i);

i = dataRecord.GetOrdinal("end_time");

source.EndTime = (System.DateTime)(System.DateTime)dataRecord.GetDateTime(i);

i = dataRecord.GetOrdinal("expired");

source.Expired = (System.Boolean)(System.Boolean)dataRecord.GetBoolean(i);

i = dataRecord.GetOrdinal("id");

source.ID = (System.Int32)(System.Int32)dataRecord.GetInt32(i);

i = dataRecord.GetOrdinal("issued_by");

source.IssuedBy = (System.String)(System.String)(dataRecord.IsDBNull(i) ? (System.String)null : dataRecord.GetString(i));

i = dataRecord.GetOrdinal("reason");

source.Reason = (System.String)(System.String)dataRecord.GetString(i);

i = dataRecord.GetOrdinal("start_time");

source.StartTime = (System.DateTime)(System.DateTime)dataRecord.GetDateTime(i);
}
开发者ID:wtfcolt,项目名称:game,代码行数:39,代码来源:AccountBanTableDbExtensions.cs

示例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 WorldStatsQuestAcceptTable source, System.Data.IDataRecord dataRecord)
{
System.Int32 i;

i = dataRecord.GetOrdinal("id");

source.ID = (System.UInt32)(System.UInt32)dataRecord.GetUInt32(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("quest_id");

source.QuestID = (NetGore.Features.Quests.QuestID)(NetGore.Features.Quests.QuestID)dataRecord.GetUInt16(i);

i = dataRecord.GetOrdinal("user_id");

source.UserID = (DemoGame.CharacterID)(DemoGame.CharacterID)dataRecord.GetInt32(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);
}
开发者ID:wtfcolt,项目名称:game,代码行数:39,代码来源:WorldStatsQuestAcceptTableDbExtensions.cs

示例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 WorldStatsUserConsumeItemTable source, System.Data.IDataRecord dataRecord)
{
System.Int32 i;

i = dataRecord.GetOrdinal("id");

source.ID = (System.UInt32)(System.UInt32)dataRecord.GetUInt32(i);

i = dataRecord.GetOrdinal("item_template_id");

source.ItemTemplateID = (DemoGame.ItemTemplateID)(DemoGame.ItemTemplateID)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("user_id");

source.UserID = (DemoGame.CharacterID)(DemoGame.CharacterID)dataRecord.GetInt32(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);
}
开发者ID:wtfcolt,项目名称:game,代码行数:39,代码来源:WorldStatsUserConsumeItemTableDbExtensions.cs

示例14: NullSafeGet

        public override object NullSafeGet(System.Data.IDataReader rs, string name)
        {
            int index = rs.GetOrdinal(name);

            if( rs.IsDBNull(index) )
            {
                if ( log.IsDebugEnabled )
                {
                    log.Debug("returning null as column: " + name);
                }

                return NullValue; //this value is determined by the subclass.
            }
            else
            {
                object val = null;
                try
                {
                    val = Get(rs, index);
                }
                catch(System.InvalidCastException ice)
                {
                    throw new ADOException(
                        "Could not cast the value in field " + name + " to the Type " + this.GetType().Name +
                        ".  Please check to make sure that the mapping is correct and that your DataProvider supports this Data Type.", ice);
                }

                if ( log.IsDebugEnabled )
                {
                    log.Debug("returning '" + ToString(val) + "' as column: " + name);
                }

                return val;
            }
        }
开发者ID:siwiwit,项目名称:andromda,代码行数:35,代码来源:NullableBaseType.cs

示例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 WorldStatsNpcKillUserTable source, System.Data.IDataRecord dataRecord)
{
System.Int32 i;

i = dataRecord.GetOrdinal("id");

source.ID = (System.UInt32)(System.UInt32)dataRecord.GetUInt32(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("npc_template_id");

source.NPCTemplateID = (System.Nullable<DemoGame.CharacterTemplateID>)(System.Nullable<DemoGame.CharacterTemplateID>)(dataRecord.IsDBNull(i) ? (System.Nullable<System.UInt16>)null : dataRecord.GetUInt16(i));

i = dataRecord.GetOrdinal("npc_x");

source.NpcX = (System.UInt16)(System.UInt16)dataRecord.GetUInt16(i);

i = dataRecord.GetOrdinal("npc_y");

source.NpcY = (System.UInt16)(System.UInt16)dataRecord.GetUInt16(i);

i = dataRecord.GetOrdinal("user_id");

source.UserID = (DemoGame.CharacterID)(DemoGame.CharacterID)dataRecord.GetInt32(i);

i = dataRecord.GetOrdinal("user_level");

source.UserLevel = (System.Int16)(System.Int16)dataRecord.GetInt16(i);

i = dataRecord.GetOrdinal("user_x");

source.UserX = (System.UInt16)(System.UInt16)dataRecord.GetUInt16(i);

i = dataRecord.GetOrdinal("user_y");

source.UserY = (System.UInt16)(System.UInt16)dataRecord.GetUInt16(i);

i = dataRecord.GetOrdinal("when");

source.When = (System.DateTime)(System.DateTime)dataRecord.GetDateTime(i);
}
开发者ID:wtfcolt,项目名称:game,代码行数:51,代码来源:WorldStatsNpcKillUserTableDbExtensions.cs


注:本文中的System.IsDBNull方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。