Let's say I have a 3-tier ASP.NET application written in C#. How are you supposed to utilize the DAL, BLL and PL correctly?
For example let's say I have a stored procedure which requires a parameter of customer ID to be passed in before it returns results. In my data access layer I could have the following:
public DataTable GetCustomerInfo(collection b)
{
DataTable table;
try
{
string returnValue = string.Empty;
DB = Connect();
DBCommand = connection.Procedure("sp_getCust");
DB.AddInParameter(DBCommand, "@CustomerID", DbType.String, b.CustomerID);
DbDataReader reader = DBCommand.ExecuteReader();
table = new DataTable();
table.Load(reader);
return table;
}
catch (Exception ex)
{
throw (ex);
}
}
Then in my BLL, I would then get that returned table and populate a dataset?
I have tried to populate a dataset without my DataTable
called, "table"
public static DataTable returnCustomer(collection b)
{
try
{
SqlDataAdapter adapt = new SqlDataAdapter();
DataSet table = new DataSet();
adapt.Fill(table, "table");
return table;
}
catch (Exception ex)
{
throw ex;
}
}
However I get these error:
Also: how to bind the dataset so that I can return the data to my textboxes?