Click here to Skip to main content
11,410,379 members (57,894 online)
Rate this: bad
good
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 10:25am
Edited 27-Nov-12 10:38am
RaisKazi33.5K
v2
Comments
ryanb31 at 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
0 Sergey Alexandrovich Kryukov 129
1 Sascha Lefévre 95
2 Maciej Los 68
3 BillWoodruff 60
4 OriginalGriff 60
0 Sergey Alexandrovich Kryukov 8,755
1 OriginalGriff 6,915
2 Maciej Los 3,390
3 Abhinav S 3,248
4 Peter Leow 3,059


Advertise | Privacy | Mobile
Web03 | 2.8.150414.5 | Last Updated 27 Nov 2012
Copyright © CodeProject, 1999-2015
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