Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. LINQ Help required

LINQ Help required

Scheduled Pinned Locked Moved ASP.NET
csharplinqhelp
6 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    salmonraju
    wrote on last edited by
    #1

    Hi , I have an application that will collect data from user (entering time sheet data) so the status of Time sheet can be any of the following 1. Open 2. Saved 3. submited 4. Under Review 5. Approvred. 6. Reject I am displaying a report on this data. Consider a case where user daily saving his time sheet but not submitting. My report will be like below Userid Date Status. 111 Date1 Open 111 Date1 Saved 111 Date1 Saved 111 Date2 Saved 111 Date3 Saved 111 Date4 Submitted 111 Date5 Under Review 111 Date6 Under Review 111 Date7 Under Review 111 Date7 Reject 111 Date7 Saved 111 Date7 Saved 111 Date7 submit : : Above are actual events done on the user time sheet . It looks like that duplicate data saved but it is displaying all the events. My requirement is to delete duplicate records if the current and previous records are having the same status . I can do his by looping through all the records using "for" by cecking previous and curent satus. But i want this is to be done in diffrent way, Can anyone suggest if we can use LINQ for this, if so please suggest me. Thanks,

    L N 2 Replies Last reply
    0
    • S salmonraju

      Hi , I have an application that will collect data from user (entering time sheet data) so the status of Time sheet can be any of the following 1. Open 2. Saved 3. submited 4. Under Review 5. Approvred. 6. Reject I am displaying a report on this data. Consider a case where user daily saving his time sheet but not submitting. My report will be like below Userid Date Status. 111 Date1 Open 111 Date1 Saved 111 Date1 Saved 111 Date2 Saved 111 Date3 Saved 111 Date4 Submitted 111 Date5 Under Review 111 Date6 Under Review 111 Date7 Under Review 111 Date7 Reject 111 Date7 Saved 111 Date7 Saved 111 Date7 submit : : Above are actual events done on the user time sheet . It looks like that duplicate data saved but it is displaying all the events. My requirement is to delete duplicate records if the current and previous records are having the same status . I can do his by looping through all the records using "for" by cecking previous and curent satus. But i want this is to be done in diffrent way, Can anyone suggest if we can use LINQ for this, if so please suggest me. Thanks,

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      You don't need LINQ to do this, and it would really be unsuitable for the task. Plain SQL should do the trick. This[^] article might help.

      "Don't confuse experts with facts" - Eric_V

      N 1 Reply Last reply
      0
      • S salmonraju

        Hi , I have an application that will collect data from user (entering time sheet data) so the status of Time sheet can be any of the following 1. Open 2. Saved 3. submited 4. Under Review 5. Approvred. 6. Reject I am displaying a report on this data. Consider a case where user daily saving his time sheet but not submitting. My report will be like below Userid Date Status. 111 Date1 Open 111 Date1 Saved 111 Date1 Saved 111 Date2 Saved 111 Date3 Saved 111 Date4 Submitted 111 Date5 Under Review 111 Date6 Under Review 111 Date7 Under Review 111 Date7 Reject 111 Date7 Saved 111 Date7 Saved 111 Date7 submit : : Above are actual events done on the user time sheet . It looks like that duplicate data saved but it is displaying all the events. My requirement is to delete duplicate records if the current and previous records are having the same status . I can do his by looping through all the records using "for" by cecking previous and curent satus. But i want this is to be done in diffrent way, Can anyone suggest if we can use LINQ for this, if so please suggest me. Thanks,

        N Offline
        N Offline
        Not Active
        wrote on last edited by
        #3

        You may be able to use linq but since you haven't indicated how or where this data is stored we can't give you a specific answer. With linq you can do joins and self joins that may be sufficient for you.


        I know the language. I've read a book. - _Madmatt "The OP herself was not sure about her question" "The OP is from India and I know what she meant." - Shameel

        1 Reply Last reply
        0
        • L Lost User

          You don't need LINQ to do this, and it would really be unsuitable for the task. Plain SQL should do the trick. This[^] article might help.

          "Don't confuse experts with facts" - Eric_V

          N Offline
          N Offline
          Not Active
          wrote on last edited by
          #4

          So you want an explaination as to why this was marked as a bad answer? The OP asked

          salmonraju wrote:

          Can anyone suggest if we can use LINQ for this

          and you reponded

          Shameel wrote:

          You don't need LINQ to do this

          The question wasn't whether or not they needed LINQ for this is was IF it were possible to use LINQ. A bad answer since it did not answer the question that was posed.

          Shameel wrote:

          Plain SQL should do the trick.

          The OP made no mention of how the data was being stored. Perhaps it was an in-memory datastore, an XML file, a flat file, etc. A bad answer since it made an unjustified assumption rather than ask for clarification. Now you have your explanation. You will no doubt disagree, that's you up to you. Now, leave it alone, go way, grow a thicker skin. Everyone else does not need to be subjected to your paranoia and sense of being pursecuted.


          I know the language. I've read a book. - _Madmatt "The OP herself was not sure about her question" "The OP is from India and I know what she meant." - Shameel

          modified on Tuesday, August 23, 2011 9:10 AM

          L M 2 Replies Last reply
          0
          • N Not Active

            So you want an explaination as to why this was marked as a bad answer? The OP asked

            salmonraju wrote:

            Can anyone suggest if we can use LINQ for this

            and you reponded

            Shameel wrote:

            You don't need LINQ to do this

            The question wasn't whether or not they needed LINQ for this is was IF it were possible to use LINQ. A bad answer since it did not answer the question that was posed.

            Shameel wrote:

            Plain SQL should do the trick.

            The OP made no mention of how the data was being stored. Perhaps it was an in-memory datastore, an XML file, a flat file, etc. A bad answer since it made an unjustified assumption rather than ask for clarification. Now you have your explanation. You will no doubt disagree, that's you up to you. Now, leave it alone, go way, grow a thicker skin. Everyone else does not need to be subjected to your paranoia and sense of being pursecuted.


            I know the language. I've read a book. - _Madmatt "The OP herself was not sure about her question" "The OP is from India and I know what she meant." - Shameel

            modified on Tuesday, August 23, 2011 9:10 AM

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #5

            Mark Nischalke wrote:

            The question wasn't whether or not they needed LINQ for this is was IF it were possible to use LINQ.

            IMO, a good professional is one who provides the best way to complete a task, not just what the OP asks for, and that is what I did. If there is problem with it, let the OP speak out, there's no need for you to keep pestering everyone here.

            Mark Nischalke wrote:

            The OP made no mention of how the data was being stored. Perhaps it was an in-memory datastore, an XML file, a flat file, etc. A bad answer since it made an unjustified assumption rather than ask for clarification.

            To light up your short lived memory, you have a problem with asking for clarification too. Here's an example[^]. So it doesn't matter what I do, you need a reason to downvote me and you see an opportunity to do it in everything I post. I have no problem with it if that gives you satisfaction. Only a minion would do it and you never fail to prove that you are one.

            Mark Nischalke wrote:

            Now, leave it alone, go way, grow a thicker skin. Everyone else does not need to be subjected to your paranoia and sense of being pursecuted.

            I did not litter your posts, it's the other way round, you came here uninvited and probably you should go away.

            "Don't confuse experts with facts" - Eric_V

            1 Reply Last reply
            0
            • N Not Active

              So you want an explaination as to why this was marked as a bad answer? The OP asked

              salmonraju wrote:

              Can anyone suggest if we can use LINQ for this

              and you reponded

              Shameel wrote:

              You don't need LINQ to do this

              The question wasn't whether or not they needed LINQ for this is was IF it were possible to use LINQ. A bad answer since it did not answer the question that was posed.

              Shameel wrote:

              Plain SQL should do the trick.

              The OP made no mention of how the data was being stored. Perhaps it was an in-memory datastore, an XML file, a flat file, etc. A bad answer since it made an unjustified assumption rather than ask for clarification. Now you have your explanation. You will no doubt disagree, that's you up to you. Now, leave it alone, go way, grow a thicker skin. Everyone else does not need to be subjected to your paranoia and sense of being pursecuted.


              I know the language. I've read a book. - _Madmatt "The OP herself was not sure about her question" "The OP is from India and I know what she meant." - Shameel

              modified on Tuesday, August 23, 2011 9:10 AM

              M Offline
              M Offline
              Manfred Rudolf Bihy
              wrote on last edited by
              #6

              Mark Nischalke wrote:

              sense of being pursecuted.

              It's either: persecuted: Human english or purrsecuted: English transliteration of cat talk (I haven't yet come up with a witty translation of what a cat would try to express by this word) Cheers!

              "With sufficient thrust, pigs fly just fine."

              Ross Callon, The Twelve Networking Truths, RFC1925

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups