Skip to content

LINQ

LINQ (all flavours)

This category can be followed from the open social web via the handle linq-e04cf296@forum.codeproject.com

783 Topics 2.8k Posts
  • Deadlock strategies using Linq To Sql and EF

    csharp database linq com question
    1
    0 Votes
    1 Posts
    1 Views
    No one has replied
  • Linq to Hashtable

    csharp database tutorial linq question
    5
    0 Votes
    5 Posts
    5 Views
    H
    worked like a charm :) thanx bud! Harvey Saayman - South Africa Junior Developer .Net, C#, SQL you.suck = (you.Passion != Programming & you.Occupation == jobTitles.Programmer) 1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111
  • how to add ---select---- in the combobox

    database tutorial question
    2
    0 Votes
    2 Posts
    2 Views
    J
    You can use the Concat method to concatenate lists together. So, if you wanted to insert a "--select--" string at position 1 in a list of strings, you could do it like this: string[] valueToInsert = { "--select--"; }; string[] otherValues = { "foo", "bar", "baz", "bat" }; var result = valueToInsert.Concat(otherValues); Tech, life, family, faith: Give me a visit. I'm currently blogging about: Upon this disciple I'll build my new religion? The apostle Paul, modernly speaking: Epistles of Paul Judah Himango
  • SQL to LINQ

    database csharp linq question
    4
    0 Votes
    4 Posts
    3 Views
    J
    Hi Nilish, Try these links: Link #1[^] Link #2[^] Link #3[^] I hope these would be helpful. John Adams ComponentOne LLC. www.componentone.com
  • Help ---> Select * from Inserted in Linq

    database help csharp linq career
    10
    0 Votes
    10 Posts
    3 Views
    H
    Doh of course it would! Well my first answer "you can't" stands correct then. You cannot use .ExecuteQuery - it would create a connection to the database using the connection string provided. How on earth one would create a connection to a trigger context I've no idea, and I think Microsoft's answer would be the same as mine - don't. And since Inserted is only visible as part of the trigger context it's never going to be visible to LINQ. 'Howard
  • Change source at runtime

    csharp database linq question
    2
    0 Votes
    2 Posts
    3 Views
    H
    dbrenth wrote: source of a table at runtime You can alter the app.config file if you mean you want to change the database the table is located on. And then you can specify the connection string when you create an instance of your data context class. dbrenth wrote: the table name will be changing from time to time. dbrenth wrote: I can query another table for the new table name This might be harder but not impossible, if this is for use on a public network you cant really do what im about to sugest because it opens up the posibility of SQL injection attacks. DO NOT do this if the data is sensitive and/or connected to a network with an internet connection! This is meant as something to get you to think towards a better idea, not for implementation string tableToQuery = "?"; //you can query your table name here sqlConnection.Open(); SqlCommand cmd = sqlConnection.CreateCommand(); cmd.CommandText = "SELECT columnName From " + tableToQuery + "WHERE someField = someCondition"; cmd.ExectuteNonQuery(); // or you can use SqlDataReader reader = cmd.ExecuteReader(); Hope this helps Harvey Saayman - South Africa Junior Developer .Net, C#, SQL you.suck = (you.passion != Programming)
  • problem in showing the column order in grid vb.net

    csharp css database help
    7
    0 Votes
    7 Posts
    3 Views
    N
    Hi , Please go through this code.... BaseClassDataContext = New BaseClassDataContext(BLLmdlCommon.strConfiguration) 'Left outer join for extracting the project table records Dim query = From p In BaseClassDataContext.GetTable(Of CP\_Project)() \_ Group Join crt In BaseClassDataContext.GetTable(Of CP\_CLM\_ClientRating)() \_ On p.RatingID Equals crt.RatingID Into ratingname = Group From c In ratingname.DefaultIfEmpty() \_ Group Join cname In BaseClassDataContext.GetTable(Of CP\_CLM\_Client)() \_ On cname.ClientID Equals p.ClientID Into clientname = Group From c1 In clientname.DefaultIfEmpty() \_ Group Join pstatus In BaseClassDataContext.GetTable(Of CP\_PRJ\_ProjectStatus)() \_ On pstatus.ProjectStatusID Equals p.ProjectStatusID Into projectstatus = Group From c2 In projectstatus.DefaultIfEmpty() \_ Group Join pjtype In BaseClassDataContext.GetTable(Of CP\_PRJ\_ProductType)() \_ On pjtype.ProductTypeID Equals p.ProductTypeID Into pj = Group From projecttype In pj.DefaultIfEmpty() \_ Select c.Rating, p.ProjectName, c1.ClientName, p.StartDate, p.DeliveryDate, c2.ProjectStatus, \_ p.ProjectID, c.RatingColor, projecttype.ProductType 'grdTasks.DataSource = query If i bind the grid now then i don't get the order of the column as i mentioned above Now instead of binding the grid now , if i create it's XML and convert into dataset . Then the order is correct. xElement = New XElement("Root", From p In query Select New XElement("Leaf", _ New XElement("Rating", p.Rating), _ New XElement("ProjectName", p.ProjectName), _ New XElement("ClientName", p.ClientName), _ New XElement("StartDate", p.StartDate), _ New XElement("DeliveryDate", p.DeliveryDate), _ New XElement("ProjectStatus", p.ProjectStatus), _ New XElement("ProjectID", p.ProjectID), _ New XElement("RatingColor", p.RatingColor), _ New XElement("RatingColor", p.ProductType))) ds = New DataSet ds.ReadXml(New System.IO.StringReader(xElement.ToString()))
  • 0 Votes
    3 Posts
    2 Views
    S
    Well what I would like is take a NewsPost object with Auther, Content etc and return it as an Atom entry. But with the ADO Data Service the whole object is put in the content part of the Atom Entry. and I can't map it to look like an Atom news feed. Is that any clearer?
  • Configurable XLinq Selection

    question csharp sysadmin xml tutorial
    7
    0 Votes
    7 Posts
    3 Views
    J
    Ah, I see, so they created the reader capable of open ended XML documents. It is strange that this functionality isn't present in the .Net framework. The XSF is very aware of backward-compatibility, you should find it all works on the newest servers/libraries ;). Thanks for the input! He who asks a question is a fool for five minutes. He who does not ask a question remains a fool forever. [Chineese Proverb] Jonathan C Dickinson (C# Software Engineer)
  • 0 Votes
    4 Posts
    2 Views
    P
    I'm not making fun of the issue. I'm telling you that the answer is there. If you have a problem with the answer, then post the followup on that thread - don't create a new one because: a. It looks like you haven't read the replies to the original post. b. Other people use these forums to find the answers to problems, so if you split your thread up it makes it almost impossible for them to find the answer. c. It looks like you're trying to bump your post to the top. Deja View - the feeling that you've seen this post before. My blog | My articles
  • 0 Votes
    2 Posts
    3 Views
    L
    Try updating to VS2008 SP1, just tried it there (it gets installed along with SP1) and it appears to work. xacc.ide - now with TabsToSpaces support IronScheme - 1.0 alpha 4a out now (29 May 2008)
  • LINQ to SQL vs ADO.NET EF

    csharp database sql-server oracle visual-studio
    9
    0 Votes
    9 Posts
    2 Views
    M
    Yeah LINQ to NHibernate has been in development for a while now, and TBH I haven't even had the inclination to check on it. HQL queries have been enough for my needs. I tend to either want one or more domain object, or an aggregation, I rarely want an anonymous type containing some unstructured garbage. The few people that have asked about LINQ for Diamond Binding seem to be happy using HQL as well. LINQ would worry me for a team involving juniors. Theres certainly some subtlety which would end up biting you (untranslatable queries, deferred execution, etc). Mark Churchill Director, Dunn & Churchill Pty Ltd Free Download: Diamond Binding: The simple, powerful, reliable, and effective data layer toolkit for Visual Studio. Alpha release: Entanglar: Transparant multiplayer framework for .Net games.
  • Adavantager of LINQ ?

    csharp linq question
    6
    0 Votes
    6 Posts
    4 Views
    M
    Any toolkit that makes it easier for the developer is going to benefit the client. The other option is developing equivalent functionality in house, and I am yet to see an in-house data layer that didnt make me cringe in disgust. Wouldn't you expect your mechanic to use the best tool for the job so they can get the job done quicker without resorting to dodgy hacks with a monkey-wrench and fencing wire? ;) Your specific scenario suggests that fast database lookups are in order. BerkelyDB is very expensive (for non-GPL use), but also very fast. I doubt the flexibility that LINQ offers is going to help you a great deal, especially if your processing code is already implemented. Mark Churchill Director, Dunn & Churchill Pty Ltd Free Download: Diamond Binding: The simple, powerful, reliable, and effective data layer toolkit for Visual Studio. Alpha release: Entanglar: Transparant multiplayer framework for .Net games.
  • Using sectiongroup tag in app.config ( C# 2008)

    csharp com tutorial workspace
    2
    0 Votes
    2 Posts
    3 Views
    H
    http://www.codeproject.com/KB/aspnet/ConfigSections.aspx[^] 'Howard
  • Problem with query.CopyToDataTable() [modified]

    database help
    6
    0 Votes
    6 Posts
    4 Views
    H
    An IQueryable is the datasouce + query. If you apply a LINQ paging function, e.g. Skip(), Take() it uses server-side paging. However, if you convert it to a DataTable it loads ALL the data, regardless of any later paging filters. So IQueryable will load 10 records for a 10-item page, and the DataTable will load the whole query. http://blogs.msdn.com/charlie/archive/2007/12/09/deferred-execution.aspx[^] 'Howard
  • Linq to XML

    tutorial csharp linq xml
    7
    0 Votes
    7 Posts
    2 Views
    H
    I think it may be to do with the references being invalid after the first one is deleted. My guess is that the XElement retains a pointer or something within the parent and this becomes invalid when an earlier one is deleted. Try a do..while loop instead, deleting one at a time var found = false; do { // find one element to remove var toDelete = (from e in xml.Descendants("child") where (from c in e.Descendants("no") where c.Value.Trim() == "1" select c).Count() > 0 select e).FirstOrDefault(); found = (toDelete != null); if (found) toDelete.Remove(); } while (found); 'Howard
  • alias problem

    help css database
    3
    0 Votes
    3 Posts
    3 Views
    K
    Linq will not support spaces in variable names. You can use _(underscore) instead of space. dim query = from p in baseclass.gettable(of table1)() _ select first_name = p.name Cheers, sekhar
  • 0 Votes
    3 Posts
    3 Views
    R
    NHibernate has linq support so you can very well do the same in NHibernate... NHibernate is way more powerful than Linq to SQL when it comes to features. Actually, none of your arguments can be used against NHibernate since NH has more lightweight objects and in many cases better SQL generation. My Blog
  • Problems on SubmitChanges() in Linq?

    csharp database linq question announcement
    4
    0 Votes
    4 Posts
    5 Views
    S
    Finally, i get the reason~ :laugh: I havnt set the primary key in my table,lol anyway, thank u all who have cared my msg~:rose:
  • I WANT CONVERSION IN linq VB.NET [modified]

    csharp linq
    4
    0 Votes
    4 Posts
    3 Views
    P
    He wants something converted in Linq, and is wanting someone to do it for him. "The clue train passed his station without stopping." - John Simmons / outlaw programmer "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon "Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham