Search Results

Search found 18661 results on 747 pages for 'linq to mysql'.

Page 108/747 | < Previous Page | 104 105 106 107 108 109 110 111 112 113 114 115  | Next Page >

  • How to pass output of a linq query to another form in C#

    - by Ani
    I have a Linq query and I want to pass the ouput (userid) to another form for further processing. var userid = from auser in allusers.Users where auser.Username == nameString select new { id = auser.UserId }; so only 'UserId' is stored in variable 'userid' and I want to use this value in another form. Is there any way we can do this. Thanks, Ani

    Read the article

  • How to get values after dictionary sorting by values with linq

    - by user301639
    hey, I've a dictionary, which i sorted by value with linq, how can i get those sorted value from the sorted result i get that's what i did so far Dictionary<char, int> lettersAcurr = new Dictionary<char, int>();//sort by int value var sortedDict = (from entry in lettersAcurr orderby entry.Value descending select entry); during the debug i can see that sortedDic has a KeyValuePar, but i cant accesses to it thanks for help

    Read the article

  • Get top N records using LINQ to Entities

    - by Abdel Olakara
    Hi all, I am using Linq to entities and would like to know if I can get a limited number of records when i query. I just need the top N records as the query do the orderby and other clauses. Is this possible or I will have to get the top N using foreach loop? Thanks in advance for Ideas and suggestions, Abdel Olakara

    Read the article

  • linq join query

    - by SamB09
    Hi, im trying to do a join in linq , however for some reason i cant access the primary key of a table. It's the 'h.ProjectId' that doesn't seem to be accepted. The following error is given CW1.SearchWebService.Bid does not contain a definition for 'ProjectId' and no extention method 'ProjectId' accepting a first argument of type 'CW1SearchWebService.Bid' var allProjects = ctxt.Project.ToList() ; var allBids = ctxt.Bid.ToArray();// return all bids var projects = (from project in allProjects join h in allBids on project.ProjectId equals h.ProjectId

    Read the article

  • remove schema from linq datacontexts

    - by Jeremy
    When I add stored procedures to a linq datacontext, by default visual studio prefixes the stored procedure with the sql schema that it is in. Is there any way to stop this? In our environment, the stored procedures may be moved to other schemas over time, and we will default the schema based on the sql user used to connect. Do I have to do this manually or can I somehow turn off the schema prefixes?

    Read the article

  • linq multiple condition on "on" clause

    - by swapna
    I have a query which have multiple conditions on on clause select * FROM CATALOGITEM with (nolock) INNER JOIN CATALOG with (nolock) ON CATALOGITEM.catalog_id = CATALOG.catalog_id and not(catalog.catalog_id = 21) and not(catalog.catalog_id = 20) WHERE ( CATALOGITEM.publish_code = 'upd' OR CATALOG_ITEM.publish_code = 'ins' OR PRODUCT.publish_code = 'upd' OR PRODUCT.publish_code = 'ins' ) How to write this in linq. Please advice.

    Read the article

  • linq, selecting columns as IEnumerable<DataRow>

    - by joe
    how can i do in linq: IEnumerable<DataRow> query = from rec in dt.AsEnumerable() where rec.Field<decimal>("column2") == 1 && foo(rec.Field<decimal>("column1")) select new { column1 = rec.Field<decimal>("column1"), column2 = rec.Field<decimal>("column2"), column3 = rec.Field<decimal>("column3")} ; this does not work. Im trying to select some columns as new datatable then join it later with some other datatable.

    Read the article

  • 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 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

  • 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

< Previous Page | 104 105 106 107 108 109 110 111 112 113 114 115  | Next Page >