コード例 #1
0
ファイル: Database.cs プロジェクト: mansehr/DGP
 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';
 }
コード例 #2
0
ファイル: Database.cs プロジェクト: mansehr/DGP
 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;
 }