Search Results

Search found 7676 results on 308 pages for 'linq extensions'.

Page 41/308 | < Previous Page | 37 38 39 40 41 42 43 44 45 46 47 48  | Next Page >

  • Linq to Sql get SqlCommand when stored procedure execution fails

    - by Tim Mahy
    Hi all, currently I'm assigning a TextWriter to the Log property of my Linq to Sql data context (per request instancing) and write this to my logging when an exception is thrown while executing a stored procedure (is strongly typed mapped in the context, so not executing a custom command) however when using ADO.NET we normally inspect the SqlCommand upon unhandled exception to read out the parameters and log them is it possible to access the SqlCommand that was used for executing a Stored Procedure in L2S so we can reuse that existing logging component? This would be far nicer than the current Log TextWriter solution.... greetings, Tim

    Read the article

  • How to use group by and having count in Linq

    - by Luke
    I am having trouble trying to convert the following query from SQL to Linq, in particular with the having count and group by parts of the query: select ProjectID from ProjectAssociation where TeamID in ( select TeamID from [User] where UserID in (4)) group by ProjectID having COUNT(TeamID) = (select distinct COUNT(TeamID) from [User] where UserID in (4)) Any advice on how to do so would be much appreciated.

    Read the article

  • Translate SQL query to LINQ

    - by ile
    PhotoAlbums table AlbumID Title Date Photos table: PhotoID Title Date AlbumID SELECT AlbumID, Title, Date, (SELECT TOP (1) PhotoID FROM Photos AS c WHERE (AlbumID = a.AlbumID)) AS PhotoID FROM PhotoAlbums AS a I need this query written in LINQ-to-SQL. Thanks in advance

    Read the article

  • Linq-To-Sql equivalent for this sql query...

    - by Pandiya Chendur
    I thus far used concatenated Id string like 1,2,3 and updated in my table using this query... if exists( select ClientId from Clients where ClientId IN (SELECT i.items FROM dbo.Splitfn(@Id,',') AS i)) begin update Clients set IsDeleted=1 where ClientId IN (SELECT i.items FROM dbo.Splitfn(@Id,',') AS i) select 'deleted' as message end What is the linq-to-sql equivalent for the above query? Any suggestion...

    Read the article

  • *Right* outer join in LINQ

    - by Rap
    Is it safe to say that there is no such thing as a right outer join in LINQ? I know to effectively create one, you'd just swap the tables in a left outer join. But can you apply the DefaultIfEmpty() method to the table on the left side of the equijoin to make it a right outer join?

    Read the article

  • LINQ to group objects according to timestamp

    - by Benny
    I have a serial of object defined as: public class Foo { public DateTime Time {get;set;} } now I want to group objects(IEnumerable<Foo>) according to the time, e.g. I want to group them according to hour or day or month. for example (group into hour): group 1(13:00-14:00) : foo1, foo2, foo3 group 2(14:00-15:00): foo4, foo5 How to write LINQ over this? hope I made myself clear.

    Read the article

  • Combining Variable Numbers of Lists w/ LINQ

    - by Anthony Compton
    I have a list (List) of objects. Each of those objects contains a list (List) of strings describing them. I'm needing to create a dropdown containing all of the distinct strings used to describe the objects (Cards). To do this, I need a list of distinct strings used. Any idea how/if this can be done with LINQ?

    Read the article

  • Am I missing something about LINQ?

    - by Jason Baker
    I seem to be missing something about LINQ. To me, it looks like it's taking some of the elements of SQL that I like the least and moving them into the C# language and using them for other things. I mean, I could see the benefit of using SQL-like statements on things other than databases. But if I wanted to write SQL, well, why not just write SQL and keep it out of C#? What am I missing here?

    Read the article

  • LInq to sql query

    - by Mohit
    Hi, I have a sql query as follows: Declare @DivisionNo INT SET @DivisionNo = 5117 SELECT distinct CASE WHEN ISNULL([DivisionNo],'') < @DivisionNo THEN @DivisionNo ELSE [DivisionNo] END as DivisionNo --,[RecordID] ,[AcctCat] ,[AcctCatDesc] ,[CostCode] ,[CostCodeDesc] FROM [dbo].[vw_eSchdl_AcctCat_CostCode] WHERE DivisionNo = @DivisionNo UNION SELECT distinct CASE WHEN ISNULL([DivisionNo],'') < @DivisionNo THEN @DivisionNo ELSE [DivisionNo] END as DivisionNo --,[RecordID] ,[AcctCat] ,[AcctCatDesc] ,[CostCode] ,[CostCodeDesc] FROM [dbo].[vw_eSchdl_AcctCat_CostCode] WHERE AcctCat not in ( SELECT [AcctCat] FROM [dbo].[vw_eSchdl_AcctCat_CostCode] WHERE DivisionNo = @DivisionNo) How can I duplicate it using linq to sql? Thanks

    Read the article

  • LINQ VB.NET variable not found when looping through grouped query

    - by Ed Sneller
    I'm trying to do the following LINQ grouping, which works in the debugger (the results are populated in the GroupedOrders object. But VS 2008 gives me the following error at design time... Name 'x' is not declared Dim GroupedOrders = (From m In thisConsultant.orders _ Group m By Key = m.commCode Into Group _ Select commCode = Key, orders = Group) For Each x In GroupedOrders Next VS 2008 gives me the following error,

    Read the article

  • Joins and subqueries in LINQ

    - by Brian
    I am trying to do a join with a sub query and can't seem to get it. Here is what is looks like working in sql. How do I get to to work in linq? SELECT po.*, p.PermissionID FROM PermissibleObjects po INNER JOIN PermissibleObjects_Permissions po_p ON (po.PermissibleObjectID = po_p.PermissibleObjectID) INNER JOIN Permissions p ON (po_p.PermissionID = p.PermissionID) LEFT OUTER JOIN ( SELECT u_po.PermissionID, u_po.PermissibleObjectID FROM Users_PermissibleObjects u_po WHERE u_po.UserID = '2F160457-7355-4B59-861F-9871A45FD166' ) used ON (p.PermissionID = used.PermissionID AND po.PermissibleObjectID = used.PermissibleObjectID) WHERE used.PermissionID is null

    Read the article

  • switch linq syntax

    - by scrat789
    var folders = from r in this.bdd.Rights join f in this.bdd.Folders on r.RightFolderId equals f.FolderId join rs in this.bdd.RightSpecs on r.RightSpecId equals rs.SpecIdRight where r.RightUserId == userId where rs.SpecRead == true where rs.SpecWrite == true select f; How transform this linq query in the other syntax? var folders = this.bdd.Rights.Where(r => r.....

    Read the article

  • Sequential GUID in Linq-to-Sql?

    - by JacobE
    I just read a blog post about NHibernate's ability to create a GUID from the system time (Guid.Comb), thus avoiding a good amount of database fragmentation. You could call it the client-side equivalent to the SQL Server Sequential ID. Is there a way I could use a similar strategy in my Linq-to-Sql project (by generating the Guid in code)?

    Read the article

  • NHibernate LINQ + PLINQ

    - by cvista
    Hi i've just started reading up on PLINQ and find it fasinating. I'm using NHib-Linq in my projects - does anyone know if there's any benefit/problems using PLINQ type queries with NHLinq? w://

    Read the article

  • Linq Expression Trees in Compact Framework.

    - by Michal Drozdowicz
    The lack of expression trees in Compact Framework has bugged me for some time now, but I haven't really looked for a solution. Today, I've found a blog post about an alternative System.Linq.Expressions built on top of Mono System.Core and used e.g. by db4o (you can find it here). My question is - have you used this library and if so, what were your experiences with it (especially regarding performance)?

    Read the article

  • How are attached properties useful in LINQ?

    - by James Cadd
    I got this question during an interview in the past and never really dug into in, but I've put some thought into it lately and I can't come up with a good answer. When I think of attached properties my mind goes straight to UI related concepts - what benefits could be had in using attached properties with LINQ? I'm starting to think the answer is "they're not" unless I find out otherwise!

    Read the article

< Previous Page | 37 38 39 40 41 42 43 44 45 46 47 48  | Next Page >