protected void Page_Load(object sender, EventArgs e) { { if (Session["SecurityLevel"] != null) { if (Session["SecurityLevel"].ToString() == "U") { Response.Redirect("default.aspx"); } } else { Response.Redirect("frmLogin.aspx"); } } if (!Page.IsPostBack) { // Declares the DataSet dsUserActivity myDataSet = new dsUserActivity(); // Fill the dataset with what is returned from the function myDataSet = clsDataLayer.GetUserActivity(Server.MapPath("PayrollSystem_DB.mdb")); // Sets the DataGrid to the DataSource based on the table grdUserActivity.DataSource = myDataSet.Tables["tblUserActivity"]; // Binds the DataGrid grdUserActivity.DataBind(); } clsDataLayer.SaveUserActivity(Server.MapPath("PayrollSystem_DB.mdb"), "frmUserActivity"); }
protected void Page_Load(object sender, EventArgs e) { if (Session["SecurityLevel"] != null) { if (Session["SecurityLevel"].ToString() == "U") { Response.Redirect("default.aspx"); } } else { Response.Redirect("frmLogin.aspx"); } if (!Page.IsPostBack) { // Declares the DataSet dsUserActivity myDataSet = new dsUserActivity(); // Fill the dataset with what is returned from the function myDataSet = clsDataLayer.GetUserActivity(Server.MapPath("PayrollSystem_DB.mdb")); // Sets the DataGrid to the DataSource based on the table grdUserActivity.DataSource = myDataSet.Tables["tblUserActivity"]; // Binds the DataGrid grdUserActivity.DataBind(); } }
public static dsUserActivity GetUserActivity(string Database) // This function gets the user activity from the tblUserActivity //public static dsUserActivity GetUserActivity(string Database) { // Add your comments here dsUserActivity DS; OleDbConnection sqlConn; OleDbDataAdapter sqlDA; // Add your comments here sqlConn = new OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + Database); // Add your comments here sqlDA = new OleDbDataAdapter("select * from tblUserActivity", sqlConn); // Add your comments here DS = new dsUserActivity(); // Add your comments here sqlDA.Fill(DS.tblUserActivity); // Add your comments here return(DS); }
// This function gets the user activity from the tblUserActivity public static dsUserActivity GetUserActivity(string Database) { dsUserActivity DS; OleDbConnection sqlConn; OleDbDataAdapter sqlDA; sqlConn = new OleDbConnection("PROVIDER=Microsoft.ACE.OLEDB.12.0;" + "Data Source=" + Database); sqlDA = new OleDbDataAdapter("select * from tblUserActivity", sqlConn); DS = new dsUserActivity(); sqlDA.Fill(DS.tblUserActivity); return(DS); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { // Declares the DataSet dsUserActivity myDataSet = new dsUserActivity(); // Fill the dataset with what is returned from the function myDataSet = clsDataLayer.GetUserActivity(Server.MapPath("PayrollSystem_DB.accdb")); // Sets the DataGrid to the DataSource based on the table grdUserActivity.DataSource = myDataSet.Tables["tblUserActivity"]; // Binds the DataGrid grdUserActivity.DataBind(); } }
// This function gets the user activity from the tblUserActivity public static dsUserActivity GetUserActivity(string Database) { dsUserActivity DS; OleDbConnection sqlConn; OleDbDataAdapter sqlDA; //Opens DB sqlConn = new OleDbConnection("PROVIDER=Microsoft.ACE.OLEDB.12.0;" + "Data Source=" + Database); // selects the user activity table from DB sqlDA = new OleDbDataAdapter("select * from tblUserActivity", sqlConn); //sets dataset for new user activity DS = new dsUserActivity(); // adds user dats activity to DB sqlDA.Fill(DS.tblUserActivity); //returns dataset with user activity return(DS); }
// This function gets the user activity from the tblUserActivity public static dsUserActivity GetUserActivity(string Database) { // Declarations of composition to be used to instantiate objects dsUserActivity DS; OleDbConnection sqlConn; OleDbDataAdapter sqlDA; // Instantiation of OleDbConnection 'sqlConn' sqlConn = new OleDbConnection("PROVIDER=Microsoft.ACE.OLEDB.12.0;" + "Data Source=" + Database); // Instantiation of OledbDataAdapter 'sqlDA' sqlDA = new OleDbDataAdapter("select * from tblUserActivity", sqlConn); // Instantiation of dsUserActivity 'DS' DS = new dsUserActivity(); //The 'Fill' method of 'sqlDA' class used with a parameter to access the table in the dataset sqlDA.Fill(DS.tblUserActivity); // The method will return information from the UserActivity Dataset return DS; }
// This function gets the user activity from the tblUserActivity public static dsUserActivity GetUserActivity(string Database) { // declaring variables dsUserActivity DS; OleDbConnection sqlConn; OleDbDataAdapter sqlDA; // assigning OleDbConnection to sqlConn sqlConn = new OleDbConnection("PROVIDER=Microsoft.ACE.OLEDB.12.0;" + "Data Source=" + Database); // assigning DB query to sqlDA sqlDA = new OleDbDataAdapter("select * from tblUserActivity", sqlConn); // instantiate dsUserActivity object DS = new dsUserActivity(); // gets the information from the DB sqlDA.Fill(DS.tblUserActivity); // returns the info from dsUserActivity return DS; }
// This function gets the user activity from the tblUserActivity public static dsUserActivity GetUserActivity(string Database) { // New instances of dsUserActivity, OleDbConnection and OleDbAdapter dsUserActivity DS; OleDbConnection sqlConn; OleDbDataAdapter sqlDA; // Connection string using OleDbConnection sqlConn = new OleDbConnection("PROVIDER=Microsoft.ACE.OLEDB.12.0;" + "Data Source=" + Database); // Select statement, retrieves all data from tblUserActivity sqlDA = new OleDbDataAdapter("select * from tblUserActivity", sqlConn); // new dsUserAvtivity instantiated DS = new dsUserActivity(); // tblUserActivity data assigned sqlDA.Fill(DS.tblUserActivity); // data is returned return(DS); }
// This function gets the user activity from the tblUserActivity public static dsUserActivity GetUserActivity(string Database) { // variables to connect to database dsUserActivity DS; OleDbConnection sqlConn; OleDbDataAdapter sqlDA; // Create object to connect to database sqlConn = new OleDbConnection("PROVIDER=Microsoft.ACE.OLEDB.12.0;" + "Data Source=" + Database); // Create object to grab data from table sqlDA = new OleDbDataAdapter("select * from tblUserActivity", sqlConn); // Object to create new dataset DS = new dsUserActivity(); // Fill in the object with the data sqlDA.Fill(DS.tblUserActivity); // Pass the data through return(DS); }
// This function gets the user activity from the tblUserActivity public static dsUserActivity GetUserActivity(string Database) { // Declarations of composition to be used to instantiate objects dsUserActivity DS; OleDbConnection sqlConn; OleDbDataAdapter sqlDA; // Instantiation of OleDbConnection 'sqlConn' sqlConn = new OleDbConnection("PROVIDER=Microsoft.ACE.OLEDB.12.0;" + "Data Source=" + Database); // Instantiation of OledbDataAdapter 'sqlDA' sqlDA = new OleDbDataAdapter("select * from tblUserActivity", sqlConn); // Instantiation of dsUserActivity 'DS' DS = new dsUserActivity(); //The 'Fill' method of 'sqlDA' class used with a parameter to access the table in the dataset sqlDA.Fill(DS.tblUserActivity); // The method will return information from the UserActivity Dataset return(DS); }
// This function gets the user activity from the tblUserActivity public static dsUserActivity GetUserActivity(string Database) { // These are the variables set for the database dsUserActivity DS; OleDbConnection sqlConn; OleDbDataAdapter sqlDA; // Here we start a new connection to the database sqlConn = new OleDbConnection("PROVIDER=Microsoft.ACE.OLEDB.12.0;" + "Data Source=" + Database); // Starting a new instance for the BD adapter sqlDA = new OleDbDataAdapter("select * from tblUserActivity", sqlConn); // A new instance to track user activity DS = new dsUserActivity(); // Add your comments here sqlDA.Fill(DS.tblUserActivity); // Add your comments here return(DS); }
protected void Page_Load(object sender, EventArgs e) { //If this is a Post back event then it will do the following if (!Page.IsPostBack) { //Initializes and Declares the DataSet dsUserActivity myDataSet = new dsUserActivity(); //Fills the data set from the payroll database using the function that was built myDataSet = clsDataLayer.GetUserActivity(Server.MapPath("PayrollSystem_DB.mdb")); //Writes the Database to to the Grid based on what is returned above grdUserActivity.DataSource = myDataSet.Tables["tblUserActivity"]; //Committs it to the page grdUserActivity.DataBind(); } }
// This function gets the user activity from the tblUserActivity public static dsUserActivity GetUserActivity(string Database) { //Create variables dsUserActivity DS; OleDbConnection sqlConn; OleDbDataAdapter sqlDA; //Create the connection string sqlConn = new OleDbConnection("PROVIDER=Microsoft.ACE.OLEDB.12.0;" + "Data Source=" + Database); //Defines sqlDA and what each will consist of sqlDA = new OleDbDataAdapter("select * from tblUserActivity", sqlConn); //Defines DS and what each will consist of DS = new dsUserActivity(); //Outputs the results from the information gathered sqlDA.Fill(DS.tblUserActivity); //Starts over for a new user return(DS); }
protected void Page_Load(object sender, EventArgs e) { if (Session["SecurityLevel"] != "A") //If the logged in user is not Admin { Response.Redirect("frmLogin.aspx"); } if (!Page.IsPostBack) { // Declares the DataSet dsUserActivity myDataSet = new dsUserActivity(); // Fill the dataset with what is returned from the function myDataSet = clsDataLayer.GetUserActivity(Server.MapPath("App_Data\\PayrollSystem_DB.mdb")); // Sets the DataGrid to the DataSource based on the table grdUserActivity.DataSource = myDataSet.Tables["tblUserActivity"]; // Binds the DataGrid grdUserActivity.DataBind(); } }
// This function gets the user activity from the tblUserActivity public static dsUserActivity GetUserActivity(string Database) { // creating OLEDB Dataset, OLEDB connection and Data adapter objects dsUserActivity DS; OleDbConnection sqlConn; OleDbDataAdapter sqlDA; //create a new connection and provide conenction string to the connection object sqlConn = new OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + Database); // create a new data adapter and provide query to the data adapter sqlDA = new OleDbDataAdapter("select * from tblUserActivity", sqlConn); // allocate new data set DS = new dsUserActivity(); // fill the dataset with the results generated from the query sqlDA.Fill(DS.tblUserActivity); // return the data set return(DS); }
protected void Page_Load(object sender, EventArgs e) { // Keep users from entering a page without loging in. if (Session["SecurityLevel"] != "A") { Response.Redirect("frmLogin.aspx"); } if (!Page.IsPostBack) { //Declares the DataSet dsUserActivity myDataSet = new dsUserActivity(); // Fill the dataset with what is returned from the function myDataSet = clsDataLayer.GetUserActivity(Server.MapPath("PayrollSystem_DB.accdb")); grdUserActivity.DataSource = myDataSet.Tables["tblUserActivity"]; // Binds the DataGrid grdUserActivity.DataBind(); } }
// This function gets the user activity from the tblUserActivity table public static dsUserActivity GetUserActivity(string Database) { // Simplified Classes Being Used dsUserActivity DS; OleDbConnection sqlConn; OleDbDataAdapter sqlDA; // Defines sqlConn Class (OleDbConnection) with provided arguments sqlConn = new OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + Database); // Defines sqlDA Class (OleDbDataAdapter) with provided arguments, selecting all from table user activity sqlDA = new OleDbDataAdapter("select * from tblUserActivity", sqlConn); // Defines DS Class (dsUserActivity) DS = new dsUserActivity(); // Outputs the results from the information gathered sqlDA.Fill(DS.tblUserActivity); // Returns the variable DS (dsUserActivity) return(DS); }
// This function gets the user activity from the tblUserActivity public static dsUserActivity GetUserActivity(string Database) { // define and intialize variables dsUserActivity DS; OleDbConnection sqlConn; OleDbDataAdapter sqlDA; // Define sqlConn and connect database sqlConn = new OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + Database); // define sqlDA which selects all items from table Personnel sqlDA = new OleDbDataAdapter("SELECT * from tblUserActivity", sqlConn); // defines DS which is database table Personnel DS = new dsUserActivity(); // Using items selected from variable sqlDA and enters into table UserActivity sqlDA.Fill(DS.tblUserActivity); // Returns the value DS which is simply a table of information from the SQL database return(DS); }
// This function gets the user activity from the tblUserActivity public static dsUserActivity GetUserActivity(string Database) { // These lines declare a new datastore as well as connection and adapter dsUserActivity DS; OleDbConnection sqlConn; OleDbDataAdapter sqlDA; // This declares a new SQL connection sqlConn = new OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + Database); // This declares a new data adapter and it selects all from userActivity tbl sqlDA = new OleDbDataAdapter("select * from tblUserActivity", sqlConn); // This declares a new userActivity object DS = new dsUserActivity(); // This uses the dataadapter to fill the userActivity tbl sqlDA.Fill(DS.tblUserActivity); // This returns the userActivity datastore information return(DS); }
// This function gets the user activity from the tblUserActivity public static dsUserActivity GetUserActivity(string Database) { // Decare object variables to allocate memory dsUserActivity DS; OleDbConnection sqlConn; OleDbDataAdapter sqlDA; // Instantiate an OleDbConnection object called "sqlConn" sqlConn = new OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + Database); // Instantiate an OleDbDataAdapter object called "sqlDA" and pass it a SQL command sqlDA = new OleDbDataAdapter("select * from tblUserActivity", sqlConn); // Instantiate a dsUserActivity object called "DS" DS = new dsUserActivity(); // Call to the sqlDA method called "Fill" passing the DS object as an argument, // passing the table User Activity with it sqlDA.Fill(DS.tblUserActivity); // Return the DS dataset object return(DS); }
//This function gets the user activity from the tblUserActivity public static dsUserActivity GetUserActivity(string Database) { //Initializes the dataset dsUserActivity DS; //Initializes the SQL connection OleDbConnection sqlConn; //Initializes the adapter OleDbDataAdapter sqlDA; //Sets the connection so it will look at the correct database sqlConn = new OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + Database); //Sets the SQL be be using the connection sqlDA = new OleDbDataAdapter("select * from tblUserActivity", sqlConn); //Set to look at the dataset DS = new dsUserActivity(); //Gets the information from the dataset sqlDA.Fill(DS.tblUserActivity); //Returns what is in the dataset return(DS); }
// This function gets the user activity from the tblUserActivity table public static dsUserActivity GetUserActivity(string Database) { // Simplified Classes Being Used dsUserActivity DS; OleDbConnection sqlConn; OleDbDataAdapter sqlDA; // Defines sqlConn Class (OleDbConnection) with provided arguments sqlConn = new OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + Database); // Defines sqlDA Class (OleDbDataAdapter) with provided arguments, selecting all from table user activity sqlDA = new OleDbDataAdapter("select * from tblUserActivity", sqlConn); // Defines DS Class (dsUserActivity) DS = new dsUserActivity(); // Outputs the results from the information gathered sqlDA.Fill(DS.tblUserActivity); // Returns the variable DS (dsUserActivity) return DS; }
// This function gets the user activity from the tblUserActivity public static dsUserActivity GetUserActivity(string Database) { dsUserActivity DS; OleDbConnection sqlConn; OleDbDataAdapter sqlDA; sqlConn = new OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + Database); sqlDA = new OleDbDataAdapter("select * from tblUserActivity", sqlConn); DS = new dsUserActivity(); sqlDA.Fill(DS.tblUserActivity); return DS; }
// This function gets the user activity from the tblUserActivity public static dsUserActivity GetUserActivity(string Database) { // Decare object variables to allocate memory dsUserActivity DS; OleDbConnection sqlConn; OleDbDataAdapter sqlDA; // Instantiate an OleDbConnection object called "sqlConn" sqlConn = new OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + Database); // Instantiate an OleDbDataAdapter object called "sqlDA" and pass it a SQL command sqlDA = new OleDbDataAdapter("select * from tblUserActivity", sqlConn); // Instantiate a dsUserActivity object called "DS" DS = new dsUserActivity(); // Call to the sqlDA method called "Fill" passing the DS object as an argument, // passing the table User Activity with it sqlDA.Fill(DS.tblUserActivity); // Return the DS dataset object return DS; }