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


C# MySqlDataReader.GetOrdinal方法代码示例

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


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

示例1: SafeGetString

 public static String SafeGetString(MySqlDataReader reader, string colName)
 {
     if (!reader.IsDBNull(reader.GetOrdinal(colName)))
         return reader.GetString(colName);
     else
         return string.Empty;
 }
开发者ID:CalumMurray,项目名称:TBCN,代码行数:7,代码来源:DatabaseConnection.cs

示例2: convertBlobToBufferData

        public static byte[] convertBlobToBufferData(String column,MySqlDataReader rdr)
        {
            int bufferSize = 1024; // Number of bytes to read at a time
            byte[] ImageData = new byte[bufferSize];
            long nBytesReturned, startIndex = 0;
            int ordinal = rdr.GetOrdinal(column);
            string image = rdr.IsDBNull(ordinal) ? null : rdr.GetString(column);
            if (image != null)
            {
                startIndex = 0;

                nBytesReturned = rdr.GetBytes(
                ordinal, // Column index of BLOB column
                startIndex, // Start position of the byte to read
                ImageData, // Byte array to recieve BLOB data
                0, // Start index of the array
                bufferSize // Size of buffer
                );
                while (nBytesReturned == bufferSize)
                {
                    startIndex += bufferSize;
                    nBytesReturned = rdr.GetBytes(ordinal, startIndex, ImageData, 0, bufferSize); // Number of bytes returned is assigned to nBytesReturned
                }
                return ImageData;
            }
            else
            {
                return null;
            }
        }
开发者ID:geekprogramming,项目名称:GPManagement,代码行数:30,代码来源:ConvertUtil.cs

示例3: SafeGetDateTime

 public static DateTime SafeGetDateTime(MySqlDataReader reader, string colName)
 {
     if (!reader.IsDBNull(reader.GetOrdinal(colName)))
         return reader.GetDateTime(colName);
     else
         return default(DateTime);
 }
开发者ID:CalumMurray,项目名称:TBCN,代码行数:7,代码来源:DatabaseConnection.cs

示例4: SafeGetInt

 public static int SafeGetInt(MySqlDataReader reader, string colName)
 {
     if (!reader.IsDBNull(reader.GetOrdinal(colName)))
         return reader.GetInt32(colName);
     else
         return default(int);
 }
开发者ID:CalumMurray,项目名称:TBCN,代码行数:7,代码来源:DatabaseConnection.cs

示例5: Logar

    public bool Logar(string nickname, string senha)
    {
        Conexao();
        bool logado = false;
        string sql = "select id, nickname, senha from Usuario where nickname= @nickname ";
        command = new MySqlCommand(sql, Conexao());

        par = new MySqlParameter("@nickname", nickname);
        par.MySqlDbType = MySqlDbType.VarChar;
        command.Parameters.Add(par);

        reader = command.ExecuteReader();

        string senhaUsuario;
        if (reader.Read())
        {
            senhaUsuario = reader.GetValue(reader.GetOrdinal("SENHA")).ToString();
            if (senhaUsuario.Equals(senha))
            {
                logado = true;
            }

        }
        FecharConexao();
        return logado;

           // command = new System.Data.SqlClient.SqlCommand(sql, conexão());
    }
开发者ID:EduardoSerdeiro,项目名称:PiratasDoCalibre,代码行数:28,代码来源:Connection.cs

示例6: SafeGetString

 public static String SafeGetString(MySqlDataReader reader, String columnname)
 {
     int colIndex = reader.GetOrdinal(columnname);
     if (!reader.IsDBNull(colIndex))
         return reader.GetString(colIndex);
     else
         return String.Empty;
 }
开发者ID:KH4IT,项目名称:MakeOver-Paris,代码行数:8,代码来源:DBUtility.cs

示例7: GetAgente

 public static Agente GetAgente(MySqlDataReader rdr)
 {
     if (rdr.IsDBNull(rdr.GetOrdinal("CODAGENT")))
         return null;
     Agente a = new Agente();
     a.CodAgent = rdr.GetInt32("CODAGENT");
     a.NomAgent = rdr.GetString("NOMAGENT");
     return a;
 }
开发者ID:rafaelgr,项目名称:ArigesMovil,代码行数:9,代码来源:CntAriGes.cs

示例8: GetUsuario

 public static Usuario GetUsuario(MySqlDataReader rdr)
 {
     if (rdr.IsDBNull(rdr.GetOrdinal("CODUSU"))) return null;
     Usuario u = new Usuario();
     u.CodUsu = rdr.GetInt32("CODUSU");
     u.NomUsu = rdr.GetString("NOMUSU");
     u.Login = rdr.GetString("LOGIN");
     u.PasswordPropio = rdr.GetString("PASSWORD_PROPIO");
     u.NivelAriges = rdr.GetInt32("NIVEL_ARIGES");
     return u;
 }
开发者ID:rafaelgr,项目名称:ArigesMovil,代码行数:11,代码来源:CntAriUs.cs

示例9: GetAlbaran

 public static Albaran GetAlbaran(MySqlDataReader rdr)
 {
     if (rdr.IsDBNull(rdr.GetOrdinal("NUMALBAR")))
         return null;
     Albaran a = new Albaran();
     a.CodTipom = rdr.GetString("CODTIPOM");
     a.NumAlbar = rdr.GetInt32("NUMALBAR");
     a.FechaAlb = rdr.GetDateTime("FECHAALB");
     a.TotalAlb = rdr.GetDecimal("TOTALALB");
     return a;
 }
开发者ID:rafaelgr,项目名称:ArigesMovil,代码行数:11,代码来源:CntAriGes.cs

示例10: GetMySQLDateTime

        public static DateTime GetMySQLDateTime(MySqlDataReader mySQLDataReader, String column)
        {
            DateTime dateTime = DateTime.MinValue;

            try
            {
                int index = mySQLDataReader.GetOrdinal(column);
                if (!mySQLDataReader.IsDBNull(index))
                {
                    MySqlDateTime mySQLDateTime = mySQLDataReader.GetMySqlDateTime(column);
                    if (mySQLDateTime.Day > 0)
                    {
                        dateTime = mySQLDateTime.GetDateTime();
                    }
                }
            }
            catch (Exception ex)
            {
                log.Error(ex.Message);
            }

            return dateTime;
        }
开发者ID:seifeet,项目名称:schoolparser,代码行数:23,代码来源:MySQLReader.cs

示例11: getDouble

 public static double? getDouble(MySqlDataReader dr, string column)
 {
     int ordinal = dr.GetOrdinal(column);
     if (dr.IsDBNull(ordinal))
     {
         return null;
     }
     else
     {
         return dr.GetDouble(ordinal);
     }
 }
开发者ID:santoshpisipati,项目名称:you-global,代码行数:12,代码来源:DataAccess.cs

示例12: getBool

 public static bool? getBool(MySqlDataReader dr, string column)
 {
     int ordinal = dr.GetOrdinal(column);
     if (dr.IsDBNull(ordinal))
     {
         return null;
     }
     else
     {
         return dr.GetBoolean(ordinal);
     }
 }
开发者ID:santoshpisipati,项目名称:you-global,代码行数:12,代码来源:DataAccess.cs

示例13: _readDateTimeField

 private static DateTime _readDateTimeField(MySqlDataReader dataReader, string fieldName)
 {
     DateTime result = default(DateTime);
     try
     {
         result = dataReader.IsDBNull(dataReader.GetOrdinal(fieldName)) ? default(DateTime) : DateTime.SpecifyKind(dataReader.GetDateTime(fieldName), DateTimeKind.Utc);
     }
     catch (Exception e)
     {
         Debug.WriteLine(e.Message, e.StackTrace);
     }
     return result;
 }
开发者ID:jstarpl,项目名称:PlayoutAutomation,代码行数:13,代码来源:DatabaseConnector.cs

示例14: _readArchiveMedia

 private static ArchiveMedia _readArchiveMedia(MySqlDataReader dataReader, ArchiveDirectory dir)
 {
     byte typVideo = dataReader.IsDBNull(dataReader.GetOrdinal("typVideo")) ? (byte)0 : dataReader.GetByte("typVideo");
     ArchiveMedia media = new ArchiveMedia()
         {
             idPersistentMedia = dataReader.GetUInt64("idArchiveMedia"),
             Directory = dir,
         };
     _mediaReadFields(dataReader, media);
     ThreadPool.QueueUserWorkItem(o => media.Verify());
     return media;
 }
开发者ID:jstarpl,项目名称:PlayoutAutomation,代码行数:12,代码来源:DatabaseConnector.cs

示例15: _mediaReadFields

 private static void _mediaReadFields(MySqlDataReader dataReader, PersistentMedia media)
 {
     uint flags = dataReader.IsDBNull(dataReader.GetOrdinal("flags")) ? (uint)0 : dataReader.GetUInt32("flags");
     byte typVideo = dataReader.IsDBNull(dataReader.GetOrdinal("typVideo")) ? (byte)0 : dataReader.GetByte("typVideo");
     media._mediaName = dataReader.IsDBNull(dataReader.GetOrdinal("MediaName")) ? string.Empty : dataReader.GetString("MediaName");
     media._duration = dataReader.IsDBNull(dataReader.GetOrdinal("Duration")) ? default(TimeSpan) : dataReader.GetTimeSpan("Duration");
     media._durationPlay = dataReader.IsDBNull(dataReader.GetOrdinal("DurationPlay")) ? default(TimeSpan) : dataReader.GetTimeSpan("DurationPlay");
     media._folder = dataReader.IsDBNull(dataReader.GetOrdinal("Folder")) ? string.Empty : dataReader.GetString("Folder");
     media._fileName = dataReader.IsDBNull(dataReader.GetOrdinal("FileName")) ? string.Empty : dataReader.GetString("FileName");
     media._fileSize = dataReader.IsDBNull(dataReader.GetOrdinal("FileSize")) ? 0 : dataReader.GetUInt64("FileSize");
     media.idFormat = dataReader.IsDBNull(dataReader.GetOrdinal("idFormat")) ? 0 : dataReader.GetUInt64("idFormat");
     media._lastUpdated = _readDateTimeField(dataReader, "LastUpdated");
     media._mediaStatus = (TMediaStatus)(dataReader.IsDBNull(dataReader.GetOrdinal("statusMedia")) ? 0 : dataReader.GetInt32("statusMedia"));
     media._mediaType = (TMediaType)(dataReader.IsDBNull(dataReader.GetOrdinal("typMedia")) ? 0 : dataReader.GetInt32("typMedia"));
     media._tCStart = dataReader.IsDBNull(dataReader.GetOrdinal("TCStart")) ? default(TimeSpan) : dataReader.GetTimeSpan("TCStart");
     media._tCPlay = dataReader.IsDBNull(dataReader.GetOrdinal("TCPlay")) ? default(TimeSpan) : dataReader.GetTimeSpan("TCPlay");
     media.idProgramme = dataReader.IsDBNull(dataReader.GetOrdinal("idProgramme")) ? 0 : dataReader.GetUInt64("idProgramme");
     media._audioVolume = dataReader.IsDBNull(dataReader.GetOrdinal("AudioVolume")) ? 0 : dataReader.GetDecimal("AudioVolume");
     media._audioLevelIntegrated = dataReader.IsDBNull(dataReader.GetOrdinal("AudioLevelIntegrated")) ? 0 : dataReader.GetDecimal("AudioLevelIntegrated");
     media._audioLevelPeak = dataReader.IsDBNull(dataReader.GetOrdinal("AudioLevelPeak")) ? 0 : dataReader.GetDecimal("AudioLevelPeak");
     media._audioChannelMapping = dataReader.IsDBNull(dataReader.GetOrdinal("typAudio")) ? TAudioChannelMapping.Stereo : (TAudioChannelMapping)dataReader.GetByte("typAudio");
     media.HasExtraLines = (typVideo & (byte)0x80) > 0;
     media._videoFormat = (TVideoFormat)(typVideo & 0x7F);
     media._idAux = dataReader.IsDBNull(dataReader.GetOrdinal("idAux")) ? string.Empty : dataReader.GetString("idAux");
     media._killDate = _readDateTimeField(dataReader, "KillDate");
     media._mediaGuid = dataReader.IsDBNull(dataReader.GetOrdinal("MediaGuid")) ? Guid.Empty : dataReader.GetGuid("MediaGuid");
     media._mediaEmphasis = (TMediaEmphasis)((flags >> 8) & 0xF);
     media._parental = (TParental)((flags >> 12) & 0xF);
     if (media is ServerMedia)
         ((ServerMedia)media)._doNotArchive = (flags & 0x1) != 0;
     media._mediaCategory = (TMediaCategory)((flags >> 4) & 0xF); // bits 4-7 of 1st byte
 }
开发者ID:jstarpl,项目名称:PlayoutAutomation,代码行数:32,代码来源:DatabaseConnector.cs


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