Have you tried this method ? I get an error on PropertyInfo[] oProps = null; Where is this created ?
u2envy12
Posts
-
Linq query to DataTable -
Linq query to DataTableHow 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 ; }
-
Grouping with LINQSorry..... 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
-
Grouping with LINQGet 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) });
-
Grouping with LINQIts TimeCategoryName Error on orderby TotalArea."TimeCategoryName" Does not contain a definition for TimeCategoryName
-
Grouping with LINQYou 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) });
-
Grouping with LINQThis 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() });
-
(The Member is defined more then once)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
-
DataGridViewComboBoxColumn and databinding?you must remove dgvPatients.Columns.Remove("Doctor_ID"); from the DataGridView
-
Union in LINQWhat 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 DateTime FormatThx 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.
-
LINQ DateTime FormatIm 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 ?
-
Check if a DLL is registeredRegistryKey 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(); }
-
Useful Chrome OverviewIts looking good. Ctrl & mouse wheel to enlarge the content is messing the layout up !!