Click here to Skip to main content
12,447,242 members (63,942 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C#
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:
++++
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
++++
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 27-Nov-12 9:25am
Updated 27-Nov-12 9:38am
RaisKazi34.4K
v2
Comments
ryanb31 27-Nov-12 15:53pm
   
What's the error? It doesn't look like it posted.

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Solved.

Found it myself Smile | :)

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

[edit]code block added[/edit]
  Permalink  
v2

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160811.3 | Last Updated 27 Nov 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100