MySql.Data.MySqlClient.MySqlDataReader.GetChar C# (CSharp) Method

GetChar() public method

Gets the value of the specified column as a single character.
public GetChar ( int i ) : char
i int
return char
    public override char GetChar(int i)
    {
      string s = GetString(i);
      return s[0];
    }

Same methods

MySqlDataReader::GetChar ( string name ) : char

Usage Example

        private TrackingEntry readEntry(MySqlDataReader reader)
        {
            TrackingEntry currentEntry = new TrackingEntry();

            currentEntry.entryID = reader.GetInt32(0);
            currentEntry.taggerID = reader.GetInt32(1);
            currentEntry.type = reader.GetChar(2);
            currentEntry.isTagged = reader.GetBoolean(3);
            currentEntry.taggerName = reader.GetString(4);
            currentEntry.entryDate = ((DateTime)reader.GetMySqlDateTime(5)).ToString("yyyy-MM-dd HH:mm:ss");

            if (reader.IsDBNull(6))
                currentEntry.tagNumber = -1;
            else
                currentEntry.tagNumber = reader.GetInt32(6);

            currentEntry.species = reader.GetString(7);

            if (reader.IsDBNull(8))
                currentEntry.city = "";
            else
                currentEntry.city = reader.GetString(8);

            if (reader.IsDBNull(9))
                currentEntry.state = "";
            else
                currentEntry.state = reader.GetString(9);

            if (reader.IsDBNull(10))
                currentEntry.country = "";
            else
                currentEntry.country = reader.GetString(10);

            if (reader.IsDBNull(11))
                currentEntry.longitude = "";
            else
                currentEntry.longitude = reader.GetString(11);

            if (reader.IsDBNull(12))
                currentEntry.latitude = "";
            else
                currentEntry.latitude = reader.GetString(12);

            if (reader.IsDBNull(13))
                currentEntry.temperature = "";
            else
                currentEntry.temperature = reader.GetString(13);

            if (reader.IsDBNull(14))
                currentEntry.precipitation = "";
            else
                currentEntry.precipitation = reader.GetString(14);

            if (reader.IsDBNull(15))
                currentEntry.windSpeed = "";
            else
                currentEntry.windSpeed = reader.GetString(15);

            if (reader.IsDBNull(16))
                currentEntry.windDirection = "";
            else
                currentEntry.windDirection = reader.GetString(16);

            return currentEntry;
        }
All Usage Examples Of MySql.Data.MySqlClient.MySqlDataReader::GetChar