Click here to Skip to main content
16,021,417 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a win form application and my datagrid does not want to fill.
My tabelname is called OPENINGHOURS.

The error message I receive is:

What do I have to set in the formload of my GUI to get those openinghours?

DAL:
++++
C#
public static DataTable GetOpeningHoursFromBranch(string branchname)
{
    try
    {

        int brid = BranchDAL.GetBranchID(branchname);

        string sql = "SELECT * FROM OPENINGHOURS WHERE BranchId=@brid";

        CommandParameterList localparams = new CommandParameterList();

        localparams.Add(new CommandParameter("@brid", brid, DbParameterTypes.Int32, ParameterDirection.Input));

        localDAC.LocalParameters = localparams;

        return localDAC.ExecuteDT(sql, AssignmentTypes.SqlStatement, "OPENINGHOURS");
    }
    catch (SQLDacException ex)
    {
        throw new BranchDALException(ex.Message);
    }
    catch (Exception ex)
    {
        throw new BranchDALException(ex.Message);
    }
}

BLL
++++
C#
public static DataTable GetOpeningHoursFromBranch(string branchname)
  {
      try
      {
          return BranchDAL.GetOpeningHoursFromBranch(branchname);
      }
      catch (BranchDALException ex)
      {
          throw new BranchBLLException(ex.Message);
      }
      catch (Exception ex)
      {
          throw new BranchBLLException(ex.Message);
      }
  }
Posted
Updated 27-Nov-12 9:38am
v2
Comments
ZurdoDev 27-Nov-12 15:53pm    
What's the error? It doesn't look like it posted.

1 solution

Solved.

Found it myself :-)

C#
DataTable localDT = new DataTable("OpeningHours");
localDT = BranchDAL.GetOpeningHoursFromBranch(textBoxBranchName.Text);
dataGridViewOpeningHours.DataSource = localDT;
dataGridViewOpeningHours.Refresh();


[edit]code block added[/edit]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900