Data Access Layer in an ASP.NET website

Posted by user3519124 on Stack Overflow See other posts from Stack Overflow or by user3519124
Published on 2014-06-04T21:07:23Z Indexed on 2014/06/04 21:24 UTC
Read the original article Hit count: 260

Filed under:
|
|

:) i have a DAL class file in my project, that my teacher sent me and explained to me but i did not really understand it. It has number of functions, and I understand only few of them, like with connecting to the database or creating a command object but there are 2 that I dont understand:

public static DataTable GetTable(string str) 
{
    OleDbConnection con = DAL.GetConnection();

    OleDbCommand cmd = DAL.GetCommand(con, str);

    DataTable dt = new DataTable();
    OleDbDataAdapter adp = new OleDbDataAdapter();
    adp.SelectCommand = cmd;
    adp.Fill(dt);
    return dt;
}

public static int ExecuteNonQuery(string str)
{
    int num = -1;
    OleDbConnection con = DAL.GetConnection();
    con.Open();
    if (con.State == ConnectionState.Open)
    {
        OleDbCommand cmd = DAL.GetCommand(con, str);
        num = cmd.ExecuteNonQuery();
        con.Close();
    }
    return num;
}

thank you :)

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about sql