ExecuteQuery() public method

public ExecuteQuery ( string query ) : DataTable
query string
return System.Data.DataTable
Ejemplo n.º 1
0
 public static DataTable GetSubjectsDataTable(DBDriver db)
 {
     try
     {
         return db.ExecuteQuery(String.Format(@"SELECT * FROM subjects order by id"));
     }
     catch(Exception e)
     {
         MessageBox.Show(e.Message);
         return null;
     }
 }
Ejemplo n.º 2
0
 static public DataTable GetGroupsDataTable(DBDriver db)
 {
     try
     {
         return(db.ExecuteQuery(String.Format(@"SELECT * FROM groups order by id")));
     }
     catch (Exception e)
     {
         MessageBox.Show(e.Message);
         return(null);
     }
 }
Ejemplo n.º 3
0
        public bool CheckIfExists()
        {
            DataTable result = null;
            bool      res    = false;

            try
            {
                result = db.ExecuteQuery(String.Format("SELECT dbo.users_check(N'{0}', '{1}') AS RESULT", this.name, this.passwd));
            }
            catch (SqlException e)
            {
                throw e;
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                if (result != null)
                {
                    if (result.Rows.Count == 1)
                    {
                        if ((bool)result.Rows[0]["RESULT"])
                        {
                            res = true;
                        }
                        result.Dispose();
                    }
                }
            }
            return(res);
        }
Ejemplo n.º 4
0
 public static DataTable GetAppointedTestForUser(DBDriver db, int userId)
 {
     return db.ExecuteQuery(String.Format(@"SELECT test_id, mark, test_time FROM users_tests WHERE user_id = {0}", userId));
 }
Ejemplo n.º 5
0
 static public DataTable GetQuestionsDataTableByTestId(DBDriver db, int testId)
 {
     return(db.ExecuteQuery(String.Format(@"SELECT * FROM questions WHERE test_id = {0}", testId)));
 }
Ejemplo n.º 6
0
 static public DataTable GetTestsDataTableBySubjectId(DBDriver db, int subjectId)
 {
     return(db.ExecuteQuery(String.Format(@"SELECT * FROM tests WHERE subject_id = {0}", subjectId)));
 }
Ejemplo n.º 7
0
 static public DataTable GetTestsDataTable(DBDriver db)
 {
     return(db.ExecuteQuery(String.Format(@"SELECT * FROM tests")));
 }
Ejemplo n.º 8
0
 public static DataTable GetUsersDataTable(DBDriver db)
 {
     return db.ExecuteQuery(String.Format(@"SELECT * FROM users"));
 }
Ejemplo n.º 9
0
 public static DataTable GetTutorsDataTable(DBDriver db)
 {
     //return db.ExecuteQuery(String.Format(@"SELECT users.id, users.real_name, users.name, users.passwd, users.email, users.additional_contats, users.last_login_date, users.registration_date, users.last_edit_date, groups.name as 'group_name' FROM users, groups WHERE users.role_id = 2"));
     return db.ExecuteQuery(String.Format(@"SELECT users.id, users.real_name, users.name, users.passwd, users.email, users.additional_contacts, users.last_login_date, users.registration_date, users.last_edit_date, users.group_id FROM users WHERE users.role_id = 2"));
 }
Ejemplo n.º 10
0
 public static DataTable GetQuestionsDataTableByTestId(DBDriver db, int testId)
 {
     return db.ExecuteQuery(String.Format(@"SELECT * FROM questions WHERE test_id = {0}", testId));
 }
Ejemplo n.º 11
0
 static public DataTable GetTutorsDataTable(DBDriver db)
 {
     //return db.ExecuteQuery(String.Format(@"SELECT users.id, users.real_name, users.name, users.passwd, users.email, users.additional_contats, users.last_login_date, users.registration_date, users.last_edit_date, groups.name as 'group_name' FROM users, groups WHERE users.role_id = 2"));
     return(db.ExecuteQuery(String.Format(@"SELECT users.id, users.real_name, users.name, users.passwd, users.email, users.additional_contacts, users.last_login_date, users.registration_date, users.last_edit_date, users.group_id FROM users WHERE users.role_id = 2")));
 }
Ejemplo n.º 12
0
 static public DataTable GetAppointedTestForUser(DBDriver db, int userId)
 {
     return(db.ExecuteQuery(String.Format(@"SELECT test_id, mark, test_time FROM users_tests WHERE user_id = {0}", userId)));
 }
Ejemplo n.º 13
0
 public static DataTable GetTestsDataTableBySubjectId(DBDriver db, int subjectId)
 {
     return db.ExecuteQuery(String.Format(@"SELECT * FROM tests WHERE subject_id = {0}", subjectId));
 }
Ejemplo n.º 14
0
 static public DataTable GetAnswersDataTableByQuestionId(DBDriver db, int questionId)
 {
     return(db.ExecuteQuery(String.Format(@"SELECT * FROM answers WHERE question_id = {0}", questionId)));
 }
Ejemplo n.º 15
0
 public static DataTable GetAnswersDataTableByQuestionId(DBDriver db, int questionId)
 {
     return db.ExecuteQuery(String.Format(@"SELECT * FROM answers WHERE question_id = {0}", questionId));
 }