I have the below LINQ Method I am trying to create. The issue seems to be the Second WHERE clause. I am getting this error -->
Cannot implicitly convert type 'System.Collections.Generic.IEnumerable<MatrixReloaded.Data.CMO.tblWorkerHistory>' to 'bool'
I also had && there vs WHERE but I was getting a similar error. I don't NEED anyth...
Environment: SQL, LINQ, C#
I have 2 WinForms running on different computers.
They all hit the same database, and it's extremely critical that these forms don't affect the state of the database. I have a couple of questions.
WinForm1, the linq queries in this form are all try/catched, if there is a concurrency conflict, I believe thi...
In my "selecting" statement I need to add two dynamic parameters when using the LinqDataSource's WhereParameters collection:
e.WhereParameters.Add(param, True)
However, the system adds these parameters as AND, but I want to perform an OR where either parameter 1 OR parameter 2 is true.
How can this be done?
...
I'm using .NET 4 and VS 2010 and have the same issue in .NET 3.5/VS 2008
The structure:
Table 1: Call
Table 2: AddressChangeRequest
Table 3: CallNotes
A single Call can have many AddressChangeRequests and many CallNotes. A Customer (customerKey) can have many Calls.
The LINQ code:
return db.Calls.Where(c => c.CustomerKey == '....
I'm not the greatest with LINQ, but I'm trying to retrieve all the ModuleAvailabilities where the academicYear is the current year.
Are there any improvements to be made here?
pathway.PathwayFoundationModule.Attach(
pathway.PathwayFoundationModule.CreateSourceQuery()
.Include("Module")
.Include("Module.ModuleAvaila...
Given the following LINQ to SQL query:
var test = from i in Imports
where i.IsActive
select i;
The interpreted SQL statement is:
SELECT [t0].[id] AS [Id] .... FROM [Imports] AS [t0] WHERE [t0].[isActive] = 1
Say I wanted to perform some action in the select that cannot be converted to SQL. Its my understanding...
How do we return a value from a stored procedure
here is my sp looks like:
create proc dbo.spInsertGroup
@ID uniqueidentifier
@GroupName varchar(100),
@IsActive bit
AS
BEGIN
insert into tblGroup
values(@ID, @GroupName, @IsActive)
Select @@IDENTITY AS ID
END
based on the return value i want to show the user some kind of feedback ...
I am using Linq.Dynamic. I have already added another SelectMany extension to all for creating a new anonymous object with the data. But, I have ran into another issue that I can not seem to solve.
I want to have extension method chaining as follows, but using the dynamic methods:
var customerandorderflat = db.Customers
.S...
I am taking a datatable and finding all the rows for a specific key that have fewer than three entries in the table for that key value. I can do this fine and it returns a grouping with the key being the id I want to group on and a list of the datarows that, for each key value, don't exist at least three times. Now I want to get a straig...
Hello, I am using the T4 templates of SubSonic 3.0 to generate classes and such for me. Well in my database I have a Zipcode table with these columns
ZipCode_rid
Zipcode (the actual zipcode in number format)
State
etc
Well, when the T4 templates run, instead of having a column like Zipcode.Zipcode I get Zipcode.ZipcodeX. Then, when t...
Here is my current code for searching tags:
public JsonResult TagSearch(string term) {
if (term == null || term == "")
return Json("");
var tags = (from t in _session.All<Tag>() where t.Name.Contains(term) select t.Name).Take(6).ToArray();
return Json(tags);
}
How could I do case insensiti...
I need to do currentKey+1. So i would like to find the index of the key value and get the next key (or first if at end). How do i find the current index of the key?
I am using a Dictionary<int, classname> and i looked for .Find or IndexOf with Linq to no avail.
...
Hi,
I have the class with enum property collection:
public enum PropertyType {
Apartment, Townhouse, AndSoOn
}
public class Company {
private readonly ISet<PropertyType> desiredPropertyTypes;
public virtual ISet<PropertyType> DesiredPropertyTypes {
get { return desiredPropertyTypes; }
}
// other stuff...
}...
I think I'm missing something very simple here.
I have an EF4 ObjectContext that contains an ObjectSet of type Thing, which is mapped to a table in my database called Things. If I add a Thing to the Things ObjectSet, that Thing is not visible in Things until I call SaveChanges() on the ObjectContext.
So, in the following test fixt...
Hi
I would like to use Linq and strongly typed views in the right way. at the moment I do the following:
Make a Model to verify agianst:
public class Menu
{
public int Id { get; private set; }
public string Text { get; private set; }
public string Action { get; private set; }
public string Controlle...
Hi,
I have implemented nerd dinner method of paging- which works great. But I want to be able to dynamically be able to order by certian fields.
How would I go about implementing this. Here is my code?
Controller:
PaginatedList<Classifieds_Ads> pageOfClassifieds = new PaginatedList<Classifieds_Ads>(classifiedsRepositry.GetClassified...
public ActionResult ReadXMLDevices(int groupID)
{
var query = from k in XMLEntities.unassigneditems
where k.DevOrAcc == true && k.Group == groupID
select k;
var view_query = from i in query
select new GetFreeDevices
{
MArticleNumber = i.Artic...
Hi There
I am pretty new to LINQ and having a issue with what seems to be irregular content caching. The website in question has 6 content areas of different subjects now on the odd occasion the content just blanks out to nothing or has the same content for all 6 areas. It will clear up this issue by itself over time or the only other w...
I have a the following domain classes:
public class Pony
{
public string Name { get; set; }
public DateTime FoundDate { get; set; }
}
public class Person
{
public ICollection<Pony> Ponies { get; private set; }
public Pony NewestPony
{
get
{
return Ponies
.OrderBy(pony => ...
Hi all,
Consider two tables, Product and Supplier. To get the required data for a grid view I need to do something like the following code snippet. SupplierID is a foreign key in the products table, but needs to be displayed in the user friendly SupplierName from the Supplier table.
SELECT Product.ProductID, Product.ProductName, Produc...