Argentini.Halide.H3Reader.GetYesNo C# (CSharp) Method

GetYesNo() public method

Read a column value in and process as "Yes", "No", or "n/a" using the GetBoolean method.
public GetYesNo ( string columnName ) : string
columnName string Name of column to retrieve.
return string
        public string GetYesNo(string columnName)
        {
            string output = "n/a";

            try
            {
                int ord = (dr_Oledb != null ? dr_Oledb.GetOrdinal(columnName) : dr.GetOrdinal(columnName));

                if (dr_Oledb != null)
                {
                    if (dr_Oledb.IsDBNull(ord))
                    {
                        output = "n/a";
                    }

                    else if (dr_Oledb.GetBoolean(ord))
                    {
                        output = "Yes";
                    }

                    else
                    {
                        output = "No";
                    }
                }

                else
                {
                    if (dr.IsDBNull(ord))
                    {
                        output = "n/a";
                    }

                    else if (dr.GetBoolean(ord))
                    {
                        output = "Yes";
                    }

                    else
                    {
                        output = "No";
                    }
                }
            }

            catch (Exception err)
            {
                _lastSqlError = err;
            }

            return output;
        }