示例#1
0
        public void loadCourses()
        {
            DBConnect objDB = new DBConnect();
            SqlCommand objCommand = new SqlCommand();

            objCommand.CommandType = CommandType.StoredProcedure;
            objCommand.CommandText = "ShowAllCourses";
            DataSet myDS = objDB.GetDataSetUsingCmdObj(objCommand);
            gvCourses.DataSource = myDS;
            gvCourses.DataBind();
        }
示例#2
0
 public DataSet GetAccounts()
 {
     DBConnect objdb = new DBConnect();
     SqlCommand sqlCommand = new SqlCommand();
     sqlCommand.CommandType = CommandType.StoredProcedure;
     sqlCommand.CommandText = "GetAllAccounts";
     DataSet dataset = objdb.GetDataSetUsingCmdObj(sqlCommand);
     return dataset;
 }
示例#3
0
        public decimal getAccountBalance(string name, float cardNumber)
        {
            DBConnect objdb = new DBConnect();
            SqlCommand sqlCommand = new SqlCommand();
            sqlCommand.CommandType = CommandType.StoredProcedure;
            sqlCommand.CommandText = "GetAccountBalance";
            sqlCommand.Parameters.AddWithValue("@Name", name);
            sqlCommand.Parameters.AddWithValue("@CardNumber", cardNumber);

            SqlParameter returnParameter = new SqlParameter("@Balance", DbType.Decimal);
            returnParameter.Direction = ParameterDirection.ReturnValue;
            sqlCommand.Parameters.Add(returnParameter);

            // Execute stored procedure using DBConnect object and the SQLCommand object
            objdb.GetDataSetUsingCmdObj(sqlCommand);

            decimal balance;
            balance = decimal.Parse(sqlCommand.Parameters["@Balance"].Value.ToString());
            return balance;
        }
示例#4
0
        public int getCreditCardCount()
        {
            DBConnect objdb = new DBConnect();
            SqlCommand sqlCommand = new SqlCommand();
            sqlCommand.CommandType = CommandType.StoredProcedure;
            sqlCommand.CommandText = "GetCreditCardCount";

            //stores the value in the variable @theCount
            SqlParameter returnParameter = new SqlParameter("@theCount", DbType.Int32);
            returnParameter.Direction = ParameterDirection.ReturnValue;
            sqlCommand.Parameters.Add(returnParameter);

            // Execute stored procedure using DBConnect object and the SQLCommand object
            objdb.GetDataSetUsingCmdObj(sqlCommand);

            int count;
            count = int.Parse(sqlCommand.Parameters["@theCount"].Value.ToString());
            return count;
        }
示例#5
0
 public DataSet getAllTransactions()
 {
     //Update Account balance using stored procedure
     DBConnect objdb = new DBConnect();
     SqlCommand sqlCommand = new SqlCommand();
     sqlCommand.CommandType = CommandType.StoredProcedure;
     sqlCommand.CommandText = "GetAllTransactions";
     DataSet dataset = objdb.GetDataSetUsingCmdObj(sqlCommand);
     return dataset;
 }
示例#6
0
        protected void gvCourses_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            int rowIndex = e.RowIndex;
            int selectedCRN = int.Parse(gvCourses.Rows[rowIndex].Cells[1].Text);
            DBConnect objDB = new DBConnect();
            SqlCommand objCommand = new SqlCommand();
            objCommand.CommandType = CommandType.StoredProcedure;
            objCommand.CommandText = "DeleteCourse";
            objCommand.Parameters.AddWithValue("@CRN", selectedCRN);
            objDB.GetDataSetUsingCmdObj(objCommand);
            objDB.DoUpdateUsingCmdObj(objCommand);

            loadCourses();
        }