Hi
I'm using Microsoft Entity model framework to access my database. I get an issue while i use this execute query command for executing Sql raw query. Let me know how could i resolve it.
svdc.CreateQuery<VideoMasterTable>(
"select * from videomastertable WHERE FREETEXT(*, '"+keyword+"')"
).ToList();
Thanks in Advance,...
(I've put "...to Entities" in brackets since I don't know if this matters at all. I guess this is a quite general LINQ related question.)
I want to check with LINQ (to Entities) if an object exists in the database. At the moment I am doing the following:
using (MyEntitiesContext aCtx = new MyEntitiesContext())
{
var aQuery = from c...
I have a table where I have items under two different types as you can see below:
How can I select from this table with Linq to Entity to get the result with two variables?
where ItemType = Type1 and ItemType == Type2
.... select new {typeOne == "", typeTwo == ""};
ID ItemName ItemType
1 ItemOne Type1
2 ItemTwo Type1
...
I am converting my project to use EF and also want to covert stored procedures into Linq-to-entities queries.
This my SQL query (simple version) that I have trouble to convert:
SELECT
CategoryID, Title as CategoryTitle,Description,
LastProductTitle,LastProductAddedDate
FROM
(
SELECT
C.CategoryID, C.Title,...
Calling Index view is giving me this very very annoying error . Can anybody tell me what to do about it
Error:
The model item passed into the dictionary is of type 'System.Collections.Generic.List1[MvcApplication13.Models.Groups]', but this dictionary requires a model item of type 'MvcApplication13.Helpers.PaginatedList1[MvcApplication1...
I have a table (TestTable) for example:
ID
Name
Parentid (FK)
and I would like to insert a new record like ID(1) Name(Test) ParentID(5) FK. How can insert a new record into TestTable with linq to entity?
var testTable = new TestTable();
testTable.ID = 1;
testTable.Name = "TestName";
testTable ...
thank you for the working example....
I developed and entity framework (.edmx) application in 4.0 in that i got all the data of my querying table and its foreign key referenced tables data also. but when i change my project to 3.5 i am unable to get the data of foreign key referenced tables data. Please help me out...
...
Hi all ... I have this method that is supposed to get the latest messages posted, from the Table (& EntitySet) called ENTRY
///method gets "days" as parameter, used in new TimeSpan(days,0,0,0);!!
using (Entities db = new Entities())
{
var entries = from ent in db.ENTRY
where ent.DATECREATE.Value > Date...
I have a query hitting EF4 using STEs and I'm having an issue with user-defined sorting. In debugging this, I have removed the dynamic sorting and am hard-coding it and I still have the issue. If I swap/uncomment the var results = xxx lines in GetMyBusinesses(), my results are not sorted any differently - they are always sorting it ascen...
I'm attempting to perform dynamic sorting of data that I'm putting into grids into our MVC UI. Since MVC is abstracted from everything else via WCF, I've created a couple utility classes and extensions to help with this. The two most important things (slightly simplified) are as follows:
public static IQueryable<TModel> ApplySortOpt...
I have a simple Linq to Enities table to query and get the most recent records using Date field
So I tried this code:
IQueryable<Alert> alerts = GetAlerts();
IQueryable<Alert> latestAlerts =
from a in alerts
group a by a.UpdateDateTime into g
select g.OrderBy(a => a.Identifier).First();
Error:
NotSupportedException: ...
I'm new to LINQ and EF, but I've been able to stumble through for the majority of the queries I have, but this one has me completely confused. No matter what I try, it comes up in SQL Profiler as a big mess :-).
I have two tables: Users and UsersProjects. The goal of this query is to list all the users who are working on projects with...
Hello,
I am using LINQ-To-Entities in C# and run queries against a SQL Compact Server 3.5 SP2. What I try to achieve is a simple group by with an additional where clause which includes a Count().
var baseIdent="expression";
var found=from o in ObservedElements
where o.ObservedRoots.BaseIdent==baseIdent
group o by o.ID into grouped
...
This is my query:
from forum in Forums
join post in Posts on forum equals post.Forum into postGroup
from p in postGroup
where p.ParentPostID==0
select new
{
forum.Title,
forum.ForumID,
LastPostTitle = p.Title,
LastPostAddedDate = p.AddedDate
}).OrderBy(o=>o.F...
I want to get IQueryable<> result when executing stored procedure.
Here is peace of code that works fine:
IQueryable<SomeEntitiy> someEntities;
var globbalyFilteredSomeEntities =
from se in m_Entities.SomeEntitiy
where
se.GlobalFilter == 1234
select se;
I can use this to apply global filter, and later use result...
I am using the Entity Framework, ASP.NET and C#3.5
I borrowed the following code to make sorting possible using a sortExpression from a GridView instead of the property of an entity:
public static IEnumerable<T> Sort<T>(this IEnumerable<T> source, string sortExpression)
{
string[] sortParts = sortExpression.Split(' ');
...
Hi there guys
I'm new to LINQ and I'm trying to check whether a TEXT column is null or empty (as String.IsNullOrEmpty).
from c in ...
...
select new
{
c.Id,
HasBio = !String.IsNullOrEmpty(c.bio)
}
Trying to use the above query produces an SqlException:
Argument data type text is invalid for ar...
I am learning Entity framework and linq-to-entities.
It's possible to get cross values from multiple tables using JOINS (join keyword) or using the navigation fields ( associations) in which case the framework knows how to reference the cross data.
My question is what to use when?
...
Hello,
Im trying to fetch an employee row from my database. The Employee tabel have a reference to a Job tabel.
Now i want to update a Employee row with some new info. I put the new info in a new Employee object and then use this object to update the old Employee information in the database. This worked great until i added the referenc...
I have an entity name "Forum" with number of properties.
I also created a partial class "Forum" that encapsulates Extra properties like int PostCount.
List<Forum> lForum = null;
lForum= (from forum in Forums
join post in Posts on forum equals post.Forum into postsInForum
select new
{
...