Search Results

Search found 6205 results on 249 pages for 'linq to nhibernate'.

Page 75/249 | < Previous Page | 71 72 73 74 75 76 77 78 79 80 81 82  | Next Page >

  • LINQ problem on remote machine

    - by HaMMeR
    I am using LINQ expressions in my code like this var obj = Collection.Single(collection = (collection.ShortName.Equals("AAA"))); The problem is that this line works fine for me, no problems. But when I upload the same executable to some remote machine with same 32 bit Windows XP. The code execution is just stopping at this line of source. Can anyone help me.

    Read the article

  • Linq to SQL - Returning two values with one query

    - by Sir Psycho
    Hi, Is it possible to return a single value and an enumerable collection using LINQ to SQL? The problem is, I'm trying to do paging across a large recordset. I only want to return 10 rows at a time so I'm using .Skip(20).Take(10) approach. However I need to know the total number of records so I can show an appropriate page x of y. Trying to avoid two separate queries. Thanks

    Read the article

  • how can i pass parameter to linq query

    - by girish
    i want to pass parameter to linq query... public IEnumerable GetPhotos() { PhotoDBDataContext db = new PhotoDBDataContext(); var tProduct = db.Photos; var query = from p in db.Photos orderby p.PhotoId descending select new { p.Album, p.AlbumId, p.Description, p.Photographer, p.PhotographerId, p.PhotoId, p.Tags, p.Thumbnail, p.Url }; return query; } in above example "orderby p.PhotoId descending" is used, i want to use parameter in place of p.PhotoId is it possible...

    Read the article

  • LINQ 2 SQL:Left outer join for my SQL statement

    - by Shyju
    Can any one tell me the LINQ 2 SQL version (in vb.net) of the below Left outer join query.I am trying to get all Employees with name "Shyju" and their address line 1 if it exist in the address table SELECT E.EMPLOYEE_NAME, E.AGE,A.ADRESS_LINE1 FROM EMPLOYEE_MASTER E LEFT OUTER JOIN ADDRESS_MASTER A ON E.ID=A.EMPLOYEE_ID WHERE E.EMPLOYEE_NAME='Shyju' Thanks in advance

    Read the article

  • T-SQL generated from LINQ to SQL is missing a where clause

    - by Jimmy W
    I have extended some functionality to a DataContext object (called "CodeLookupAccessDataContext") such that the object exposes some methods to return results of LINQ to SQL queries. Here are the methods I have defined: public List<CompositeSIDMap> lookupCompositeSIDMap(int regionId, int marketId) { var sidGroupId = CompositeSIDGroupMaps.Where(x => x.RegionID.Equals(regionId) && x.MarketID.Equals(marketId)) .Select(x => x.CompositeSIDGroup); IEnumerator<int> sidGroupIdEnum = sidGroupId.GetEnumerator(); if (sidGroupIdEnum.MoveNext()) return lookupCodeInfo<CompositeSIDMap, CompositeSIDMap>(x => x.CompositeSIDGroup.Equals(sidGroupIdEnum.Current), x => x); else return null; } private List<TResult> lookupCodeInfo<T, TResult>(Func<T, bool> compLambda, Func<T, TResult> selectLambda) where T : class { System.Data.Linq.Table<T> dataTable = this.GetTable<T>(); var codeQueryResult = dataTable.Where(compLambda) .Select(selectLambda); List<TResult> codeList = new List<TResult>(); foreach (TResult row in codeQueryResult) codeList.Add(row); return codeList; } CompositeSIDGroupMap and CompositeSIDMap are both tables in our database that are represented as objects in my DataContext object. I wrote the following code to call these methods and display the T-SQL generated after calling these methods: using (CodeLookupAccessDataContext codeLookup = new CodeLookupAccessDataContext()) { codeLookup.Log = Console.Out; List<CompositeSIDMap> compList = codeLookup.lookupCompositeSIDMap(5, 3); } I got the following results in my log after invoking this code: SELECT [t0].[CompositeSIDGroup] FROM [dbo].[CompositeSIDGroupMap] AS [t0] WHERE ([t0].[RegionID] = @p0) AND ([t0].[MarketID] = @p1) -- @p0: Input Int (Size = 0; Prec = 0; Scale = 0) [5] -- @p1: Input Int (Size = 0; Prec = 0; Scale = 0) [3] -- Context: SqlProvider(Sql2005) Model: AttributedMetaModel Build: 3.5.30729.1 SELECT [t0].[PK_CSM], [t0].[CompositeSIDGroup], [t0].[InputSID], [t0].[TargetSID], [t0].[StartOffset], [t0].[EndOffset], [t0].[Scale] FROM [dbo].[CompositeSIDMap] AS [t0] -- Context: SqlProvider(Sql2005) Model: AttributedMetaModel Build: 3.5.30729.1 The first T-SQL statement contains a where clause as specified and returns one column as expected. However, the second statement is missing a where clause and returns all columns, even though I did specify which rows I wanted to view and which columns were of interest. Why is the second T-SQL statement generated the way it is, and what should I do to ensure that I filter out the data according to specifications via the T-SQL? Also note that I would prefer to keep lookupCodeInfo() and especially am interested in keeping it enabled to accept lambda functions for specifying which rows/columns to return.

    Read the article

  • Linq to Entity Dynamic where clause

    - by GodSmart
    I have Linq to Entity query like you can see below I am using it five times in my code, everything that change is where clause. is it possible to create a method and pass just where values, not to write all code five times. Thank you items = from t1 in _entities.table1 join t2 in _entities.Table2 on t1.column1 equals t2.column1 join t3 in _entities.Table3 on t1.column2 equals t3.column2 join t4 in _entities.Table4 on t1.column3 equals t4.column3 where **t1.column5 == Something** select new { t1.column7, t2.column8, t3.column9, t4.column10 };

    Read the article

  • VB.Net Linq Datatable Exists

    - by LarsH
    I would like to use Linq instead of below function : Friend Function IsCollectionInTable2(ByVal apps As DataTable, ByVal collectionId As String) As Boolean For Each row As DataRow In apps.Rows If row("CollectionId").ToString = collectionId Then Return True Next Return False End Function The best I can do is below: Friend Function IsCollectionInTable(ByVal apps As DataTable, ByVal collectionId As String) As Boolean Return (From row In apps.AsEnumerable() Where (row.Field(Of String)("CollectionId") = collectionId) Select row.Field(Of String)("CollectionId")).Count > 0 End Function I would like to use Exists or Any in above function. Performance could be an issue,

    Read the article

  • Which is more flexible in regards to database changes, EF 4 or Linq to SQL

    - by JBeckton
    Reading about both Linq to SQL and Entity Framework I have developed the impression that EF is more suitable for apps that get data from multiple data sources. But as I am reading about MVC2 models I see an example where EF is more loosely coupled with your data model. If I have to add or remove some columns from a table then what is involved in updating my model or DAL with each of these implementations?

    Read the article

  • a linq query to find something

    - by rap-uvic
    Hi, I have object A which contains multiple instances of object B, which in turn contains multiple instances of object C. I need to write a function which, given Object A needs search through instances of objects B and objects C and find a particular object C. How would I do this using LINQ?

    Read the article

  • Linq to Sql: Generic Stored Procedures

    - by Eric
    Hello everyone, I am using Linq-to-Sql for a C# application and am currently working on some stored procedures. The application is for a newspaper, and a sample stored procedure is the following: ALTER PROCEDURE dbo.Articles_GetArticlesByPublication @publicationDate date AS SELECT * FROM Articles WHERE Articles.PublicationDate=@publicationDate Anyway, this query gets all of the articles where the publication date is equal to the argument (publicationDate). How can I alter this so that the argument can handle multiple publication dates? Also, I'd prefer not to use "BETWEEN," rather, I want to pick and choose dates.

    Read the article

  • LINQ: How to skip one then take the rest of a sequence

    - by Marcel
    Hi All, i would like to iterate over the items of a List<T>, except the first, preserving the order. Is there an elegant way to do it with LINQ using a statement like: foreach (var item in list.Skip(1).TakeTheRest()) {.... I played around with TakeWhile , but was not successful. Probably there is also another, simple way of doing it?

    Read the article

  • how to Update the XMl value and write back using LINQ

    - by NewDev
    Hi all, i am having query for update the node value using Linq, For example i am have to update <Student> <studentdetail> <studentname>test</studentname> <libraryid>hem001</libraryid> </studentdetail> </Student> in above xml i want to change the value of Student name "test" ti something else like "Undertest" regards NewDev

    Read the article

  • Converting SQL Query to LINQ 2 SQL expression

    - by Shyju
    How can i rewrite the below SQL query to its equivalent LINQ 2 SQL expression (both in C# and VB.NET) SELECT t1.itemnmbr, t1.locncode,t1.bin,t2.Total FROM IV00200 t1 (NOLOCK) INNER JOIN IV00112 t2 (NOLOCK) ON t1.itemnmbr = t2.itemnmbr AND t1.bin = t2.bin AND t1.bin = 'MU7I336A80'

    Read the article

  • Updating value in Linq to SQL IEnumerable

    - by Learner
    Using Linq to SQL: if(!parentlist.childlist.Contains(row1)) parentlist.childlist.Add(row1); else How do I update the required childlist row with row1? Each row of the child list has a unique id. parentlist implements IEnumerable and childlist is IList.

    Read the article

  • Supported Linq for WCF Data Services

    - by jfar
    I'm looking for the full list of supported linq extension methods that are compatible with WCF Data Services. By trial and error I've found First() and Single() aren't supported, any others? This gives me a pretty good idea of whats supported, I just don't know whats actually translated via the IQueryProvider.

    Read the article

  • How do I cache query results using LINQ?

    - by Vince
    Hi, Is there any way to cache LINQ to SQL queries by looking at the parameters that were previously passed and bypass the database all together? I know L2S caches some database calls, but I'm looking for a permanant solution as in, even if the applciation restarts, that cache reloads and never asks the database again. Are there any frameworks for C#?

    Read the article

  • LINQ to SQL table naming

    - by Ivo
    I am using VS2010 and C# When I map/select my database tables with LINQ to SQL I have to option to change the "member" propery, but when i delete the table (because I changed something in the schema for example) and add it again the member value gets "reset". Is it possible to set/override this member programmaticly, so that I dont have to change it by hand everytime I mean the member option of '<'Table Name="dbo.table1" Member="table1"

    Read the article

  • How can I join conditionally in LINQ queries?

    - by Steve Crane
    If I have two tables; Drivers keyed by DriverId and Trips with foreign keys DriverId and CoDriverId, and I want to find all trips where a driver was either the driver or co-driver I could code this in Transact-SQL as select d.DriverId, t.TripId from Trips t inner join Drivers d on t.DriverId = d.DriverId or t.CoDriverId = d.DriverId How could this be coded as a LINQ query?

    Read the article

  • Left outer join in LINQ is showing exception

    - by stackuser3
    The folloqing is the excpetion I am getting The null value cannot be assigned to a member with type System.Int32 which is a non-nullable value type. below is my LINQ Statement where QuestionId is the primary key in my table var questionViewsData = from questionViews in objDc.SC_QuestionsViews join questions in objDc.SC_Questions on questionViews.QuestionId equals questions.QuestionId into qs from questions in qs.DefaultIfEmpty() where questionViews.CreatedDate.Date == new DateTime(2010, 4,27) select new { Selected =(questions == null ?-1:questions.QuestionId), QuestioinTitle = questions.Title, VotesCount = questions.VotesCount }; Let me know how to resolve this

    Read the article

< Previous Page | 71 72 73 74 75 76 77 78 79 80 81 82  | Next Page >