Data Access Layer in an ASP.NET website
- by user3519124
:)
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 :)