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...
I'm wrote an insert method that uses linq and loops through 2 lists, the first being able to go up to 14k objects and the send about 8k objects.
Whenever I run this method, I always get "Transaction Timeout Exception". Can you help me improve this?
public void InsertNewInventoryGoodsEvents(List<GoodsEvent> eventsList, List<InventoryGoo...
I have a many to many relationship as follows:
Products
ProductID
Description
ProductFeatures
ProductFeatureID
ProductID
FeatureID
Features
FeatureID
Description
Any Product can have many Features.
I then come along with an iQueryable called "SearchFeatures" which contains two particular Feature objects that I want to search on.
I ...
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 == '....
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...
Given something like the following (just thrown together as an example)
Employee ID | Time In | Position | Shift Length
1 | April 1 08:00 | Manager | 8
0 | April 1 08:00 | Maint | 8
1 | April 2 08:00 | Manager | 8
2 | April 1 08:00 | Clerk | 4
1 | April 3 08:00 |...
Hello
I'm crating a simple MVC app that has People and Notes tables.
Using the repository method and LINQ to SQL to access the data.
Each person has a single note for a day and the note has a CreatedAt. Foreign Key in Note table as PersonID.
I have managed to get CRUD working for both Person and Note independently but I'd like to be ...
I have written quite a bit of code which uses the Linq2Sql table relationships provided to me just by having foreign keys on my database. But, this is proving to be a bit laborious to mock data for my unit tests. I have to manually set up any relationships in my test harness.
So, I am wondering if writing Linq joins rather than relying ...
I'm new to LINQ and am having a problem getting proper results from a simple (working) stored procedure that takes no parameters and returns a single Integer. When calling this sproc with LINQ its returnvalue is always 0. When run using tableadapter or directly on the sql server it works, returning 6 digit values like 120123.
Here is ...
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'm struggling to get what I thought would be a simple LINQ-to-SQL query to work. I can construct the query ok and can verify that the SQL it generates is correct but when executing get the dreaded "System.NotSupportedException: Queries with local collections are not supported" exception.
I've simplified my query but in short the query ...
I want to create either "LINQ to SQL" classes or use "Entity Framework" from Visual Studio Express 2010. When I attempt to add a data source my only options are:
"Microsoft Access Database File"
"Microsoft SQL Server Compact 3.5"
"Microsoft SQL Server Database File"
Do I need VS2010 Pro to use LINQ to SQL or EF? I thought I could d...
I am using linq to sql , and I return a queryable result from linq to sql :
var qry = from p in table select p;
Then I use this to bind to a xtragrid:
GridControl.DataSource = qry;
Then If I edit the records in xtraGrid, I just need to call
dataContext.submitChanges() to submit the changes back to database.
My question is :
Am I ...
I wrote the following method that receives a list and updates the database based on certain criteria:
public void UpdateInventoryGoods(List<InventoryGoods> list, int id)
{
int index = 0;
var query = from inventoryGoods in context.InventoryGoods
where inventoryGoods.ParentId == id...
I've got a very basic database schema and have created a dbml from it. Two tables are related in a one-to-many. (A)1-*(B) ... hence each A gets an EntitySet called "BSet".
If I do:
foreach (var a in db.A)
{
Console.WriteLine(a.Name);
foreach (var b in a.BSet)
{
Console.WriteLine(b.Number);
}
}
I find that it prints out t...
Hi
below is a sql server table, which is used to hold users prediction for soccer matches. a user can predict either a home win, an away win or a draw/tie for a specific soccer match.
how can i query this table to find the top 3 predictions, the top 3 games must be distinct gameId's
either SQL or LINQ solution would be much appriciate...
I've got two tables in my database Users and HealthMonitor. In the HealthMonitor table I have a UserID field that is mapped to the ID field in the Users table.
Pretty straight forward so far...
I left the UserID field in the HealthMonitor table as "Nullable" so that I can have the system insert a NULL value into the table if there is ...
Hello
I want to update my database using a LINQ2SQL query.
However this seems for some reason to be a very ugly task compared to the otherwise lovely LINQ code.
The query needs to update two tables.
tbl_subscription
(
id int,
sub_name nvarchar(100),
sub_desc nvarchar(500),
and so on.
)
tbl_subscription2tags
(
sub_id (...
I has method which should return users with highest points.
Points are stored in aspnet_Profile table, so i can get these points in the way like this: ProfileBase.Create(mu.UserName).GetPropertyValue("Points").
So at first i call
IEnumerable<MembershipUser> users = Membership.GetAllUsers().Cast<MembershipUser>();
and then (i'm usi...
Hi ,
I don't know what's wrong with this code , this code compile successfully but doesn't update database . do i miss some thing ?
DataClassesDataContext db = new DataClassesDataContext();
var query = from p in db.AllPatiences
select p;
int newID = 1001;
foreach (AllPatience patient in query)
{
patient.Id = newID.ToS...