public char getUserOnlineStatus(string id) { try { char itsChar; itsCommand = new OdbcCommand("",itsConnection); itsCommand.CommandText = "SELECT status FROM users WHERE userID=\'" + id + "\'";; itsDataReader = itsCommand.ExecuteReader(); if(itsDataReader.Read()) { itsChar = itsDataReader.GetChar(0); itsDataReader.Close(); itsCommand.Dispose(); return itsChar; } else { itsDataReader.Close(); itsCommand.Dispose(); return 'Z'; } } catch(OdbcException MyOdbcException) //Catch any ODBC exception .. { this.handleException(MyOdbcException); } return 'Z'; }
public bool getUserLogginStatus(int itsId) { try { char itsChar; itsCommand = new OdbcCommand("",itsConnection); itsCommand.CommandText = "SELECT status FROM users WHERE userID=\'" + itsId + "\'"; itsDataReader = itsCommand.ExecuteReader(); if(itsDataReader.Read()) { itsChar = itsDataReader.GetChar(0); if(itsChar == 'Y') { itsCommand.Dispose(); itsDataReader.Close(); return true; } else { itsCommand.Dispose(); itsDataReader.Close(); return false; } } else { itsDataReader.Close(); itsCommand.Dispose(); return false; } } catch(OdbcException MyOdbcException) //Catch any ODBC exception .. { this.handleException(MyOdbcException); } return false; }