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. General Programming
  3. C#
  4. How To Use Guid Filter in Select StateMent :( :( :(

How To Use Guid Filter in Select StateMent :( :( :(

Scheduled Pinned Locked Moved C#
helpcsharplinqtutorialquestion
6 Posts 3 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.
  • M Offline
    M Offline
    mhd sbt
    wrote on last edited by
    #1

    hi to all i want wrote a one line Code Similare This

    myDataTable.Select("Guid IN ('8556c1fd-d4a1-4c1c-b2af-c1fa9403ce4e')”)

    but i face With this Problem 'myDataTable.Select("Guid IN ('8556c1fd-d4a1-4c1c-b2af-c1fa9403ce4e')")' threw an exception of type 'System.Data.EvaluateException' System.Data.DataRow[] {System.Data.EvaluateException} this is a one line Code That is ok, but i dont want use of this Method

    myDataTable.Select("Guid = '8556c1fd-d4a1-4c1c-b2af-c1fa9403ce4e'”)

    any way is Exist that Use Guid in Linq FilterExpresion With 'IN'???? thank for Any Help

    V Richard DeemingR 2 Replies Last reply
    0
    • M mhd sbt

      hi to all i want wrote a one line Code Similare This

      myDataTable.Select("Guid IN ('8556c1fd-d4a1-4c1c-b2af-c1fa9403ce4e')”)

      but i face With this Problem 'myDataTable.Select("Guid IN ('8556c1fd-d4a1-4c1c-b2af-c1fa9403ce4e')")' threw an exception of type 'System.Data.EvaluateException' System.Data.DataRow[] {System.Data.EvaluateException} this is a one line Code That is ok, but i dont want use of this Method

      myDataTable.Select("Guid = '8556c1fd-d4a1-4c1c-b2af-c1fa9403ce4e'”)

      any way is Exist that Use Guid in Linq FilterExpresion With 'IN'???? thank for Any Help

      V Offline
      V Offline
      V 0
      wrote on last edited by
      #2

      Is the Guid in the database as a string representation or a byte [] ?

      V.
      (MQOTD rules and previous solutions)

      M 1 Reply Last reply
      0
      • M mhd sbt

        hi to all i want wrote a one line Code Similare This

        myDataTable.Select("Guid IN ('8556c1fd-d4a1-4c1c-b2af-c1fa9403ce4e')”)

        but i face With this Problem 'myDataTable.Select("Guid IN ('8556c1fd-d4a1-4c1c-b2af-c1fa9403ce4e')")' threw an exception of type 'System.Data.EvaluateException' System.Data.DataRow[] {System.Data.EvaluateException} this is a one line Code That is ok, but i dont want use of this Method

        myDataTable.Select("Guid = '8556c1fd-d4a1-4c1c-b2af-c1fa9403ce4e'”)

        any way is Exist that Use Guid in Linq FilterExpresion With 'IN'???? thank for Any Help

        Richard DeemingR Offline
        Richard DeemingR Offline
        Richard Deeming
        wrote on last edited by
        #3

        Try converting the column to a string in the filter expression:

        myDataTable.Select("Convert(Guid, 'System.String') IN ('8556c1fd-d4a1-4c1c-b2af-c1fa9403ce4e')")


        "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

        "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

        M 1 Reply Last reply
        0
        • V V 0

          Is the Guid in the database as a string representation or a byte [] ?

          V.
          (MQOTD rules and previous solutions)

          M Offline
          M Offline
          mhd sbt
          wrote on last edited by
          #4

          Guid save in DataBase AS UniqueIdentifier

          V 1 Reply Last reply
          0
          • M mhd sbt

            Guid save in DataBase AS UniqueIdentifier

            V Offline
            V Offline
            V 0
            wrote on last edited by
            #5

            That's most probably the culprit. This "UniqueIdentifier" is not a string and apparently your database engine cannot convert it implicitly. Try to follow Richard Deeming's advice. Alternatively you could use a parametrized query instead and try to pass the guid as a byte[] (blob) instead of a string. Hope this helps.

            V.
            (MQOTD rules and previous solutions)

            1 Reply Last reply
            0
            • Richard DeemingR Richard Deeming

              Try converting the column to a string in the filter expression:

              myDataTable.Select("Convert(Guid, 'System.String') IN ('8556c1fd-d4a1-4c1c-b2af-c1fa9403ce4e')")


              "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

              M Offline
              M Offline
              mhd sbt
              wrote on last edited by
              #6

              thanks Mr Deeming,Your Answer Save My life :)

              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