當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。