Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
U

u2envy12

@u2envy12
About
Posts
14
Topics
5
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Linq query to DataTable
    U u2envy12

    Have you tried this method ? I get an error on PropertyInfo[] oProps = null; Where is this created ?

    LINQ question csharp database linq

  • Linq query to DataTable
    U u2envy12

    How do I convert a Linq Query to a DataTable. Code Follows ? using (EmployeeDataContext empCtx = new EmployeeDataContext(GlobalMethods.SqlConnectionString)) { var rsEmp = from emp in empCtx.Employees join payp in empCtx.PayPeriods on emp.PayperiodID equals payp.PayPeriodID join rst in empCtx.Rosters on emp.RosterID equals rst.RosterID join dep in empCtx.Departments on emp.DepartmentID equals dep.DepartmentID join div in empCtx.Divisions on emp.DivisionID equals div.DivisionID join cst in empCtx.CostCentres on emp.CostCentreID equals cst.CostCentreID join grp in empCtx.Groups on emp.GroupID equals grp.GroupID where emp.OrganizationID == UserClass.OrganizationID orderby emp.EmployeeNumber select new { emp.EmployeeID, emp.EmployeeNumber, emp.EmployeeName, emp.Surname, emp.BadgeNumber, payp.PayPeriodName, rst.RosterName, div.DivisionName, dep.DepartmentName, cst.CostCentreName, grp.GroupName, emp.EmploymentStatus, emp.EndOfEmployment }; DataTable myTable = (DataTable)rsEmp; DataView filteredData = new DataView(myTable); dataGridView1.DataSource = filteredData; //Or //OR DataTable myTable = rsEmp.CopyToDataTable(); dataGridView1.DataSource = myTable ; }

    LINQ question csharp database linq

  • Grouping with LINQ
    U u2envy12

    Sorry..... Let me get the names correct. DailyHoursID 1 2 3 Table2 HoursTimeCategory DailyHoursID TimeCategoryID Hours Min 1 0 8 30 1 1 9 0 2 0 6 30 Table3 TimeCategory TimeCategoryID TimeCategoryName 1 Normal Time 2 Over Time Join on Table3 to get the TimeCategoryName

    LINQ csharp linq question

  • Grouping with LINQ
    U u2envy12

    Get an error on orderby TotalArea.TimeCategoryName If I remove orderby Get an error on TimeCategory = TotalArea.TimeCategoryName, var rsDailyHoursTC1 = (from d in Empctx.DailyHoursTimeCategories join tc in Empctx.TimeCategories on d.TimeCategoryID equals tc.TimeCategoryID where empCatList.Contains(d.DailyHoursID) group d by tc.TimeCategoryName into TotalArea orderby TotalArea.TimeCategoryName select new { TimeCategory = TotalArea.TimeCategoryName, Hours = TotalArea.Sum(h => h.Hours), Min = TotalArea.Sum(m => m.Minutes) });

    LINQ csharp linq question

  • Grouping with LINQ
    U u2envy12

    Its TimeCategoryName Error on orderby TotalArea."TimeCategoryName" Does not contain a definition for TimeCategoryName

    LINQ csharp linq question

  • Grouping with LINQ
    U u2envy12

    You missing a by clause group by lambada Error on TotalArea.TimeCategory, var rsDailyMinutesTC1 = (from d in Empctx.DailyHoursTimeCategories join tc in Empctx.TimeCategories on d.TimeCategoryID equals tc.TimeCategoryID where empCatList.Contains(d.DailyHoursID) group d.TimeCategory by tc.TimeCategoryName into TotalArea select new { TimeCategory = TotalArea.TimeCategory, Hours = TotalArea.Sum( h => h.Hours), Min = TotalArea.Sum( m => m.Min) });

    LINQ csharp linq question

  • Grouping with LINQ
    U u2envy12

    This is what I have..... DailyHoursID 1 2 3 Table2 HoursTimeCategory DailyHoursID TimeCategory Hours Min 1 0 8 30 1 1 9 0 2 0 6 30 How do I get a result set of the bellow using LINQ TimeCategory Hours Min 0 14 60 1 9 0 Im getting the Hours Summed up. I just cant get the Minutes to sum up. var rsDailyHoursTC = (from d in Empctx.DailyHoursTimeCategories join tc in Empctx.TimeCategories on d.TimeCategoryID equals tc.TimeCategoryID where empCatList.Contains(d.DailyHoursID) group d.Hours by tc.TimeCategoryName into TotalArea select new { Category = TotalArea.Key, Hours = TotalArea.Sum() });

    LINQ csharp linq question

  • (The Member is defined more then once)
    U u2envy12

    I have two tables in a DataContext class. Table one Department DepartmentID PRIMARY KEY OrganizationID DepartmentName Table Two UserDeparment DepartmentID UserID COMPOSITE KEY My linq : var rsUserDep = (from usrdep in usrDptCtx.UserDepartments join dep in usrDptCtx.Departments on usrdep.DepartmentID equals dep.DepartmentID where usrdep.UserID == userID & dep.OrganizationID == 2 select new { usrdep.UserID, usrdep.DepartmentID }); On usrdep.DepartmentID I get an error......: (The Member is defined more then once) Ambiguity between UserDepartment.DepartmentID And UserDepartment.DepartmentID

    LINQ csharp linq help

  • DataGridViewComboBoxColumn and databinding?
    U u2envy12

    you must remove dgvPatients.Columns.Remove("Doctor_ID"); from the DataGridView

    C# csharp database visual-studio help question

  • Union in LINQ
    U u2envy12

    What is the criteria for a union in Linq. The criteria for SQL is that the select clumns must have the same name & amount of columns between the two tables. This is what I have & an error is thrown in linq. var rsPunch = (from a in PunchCtx.AccessPunches select new { a.1, a.2 }); var rsPunch1 = (from t in PunchCtx.TimeAtendancePunches select new { t.1, t.2 }); var union = rsPunch.Union(rsPunch1);

    LINQ csharp database linq help question

  • LINQ DateTime Format
    U u2envy12

    Thx Guffa I found the problem. A DateTime null in link is not a null in sql. I was only passing one DateTime value & thinking the other DateTime will be null. I passed both DateTime values & no error.

    C# csharp question database sql-server linq

  • LINQ DateTime Format
    U u2envy12

    Im converting all code from ADO.net to LINQ. In ADO i could add a DateTime field into SQL when adding a record. Im doing the same with LINQ & im getting an error. SqlDateTime Overflow. Must be between 1/1/1753 12:00:00 AM AND 12/31/9999 11:59:59 PM. My format is 2008/11/03 11:00:00 AM. How can I make it take this format & store it in sql server as the required format & not throw this error ?

    C# csharp question database sql-server linq

  • Check if a DLL is registered
    U u2envy12

    RegistryKey clsid=Registry.ClassesRoot.OpenSubKey("CLSID"); string[] ClsIDs=clsid.GetSubKeyNames(); string subkey=""; for (int i=0; i<clsids.length;> { subkey=ClsIDs[i]; if (subkey.Substring(0,1)!="{") continue; RegistryKey cls=Registry.ClassesRoot.OpenSubKey("CLSID\\"+subkey+"\\InprocServer32"); if (cls==null) continue; string x=cls.GetValue("","").ToString(); }

    C# csharp database question

  • Useful Chrome Overview
    U u2envy12

    Its looking good. Ctrl & mouse wheel to enlarge the content is messing the layout up !!

    The Lounge html com
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups