Click here to Skip to main content
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 9:25am
Edited 27-Nov-12 9:38am
RaisKazi32.9K
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 878
1 OriginalGriff 410
2 CPallini 275
3 George Jonsson 226
4 Richard Deeming 145
0 OriginalGriff 5,450
1 CPallini 4,500
2 Sergey Alexandrovich Kryukov 4,482
3 George Jonsson 3,057
4 Gihan Liyanage 2,445


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