Hoppa till huvudinnehållet

Query task where clause with 'AND'

Kommentarer

6 kommentarer

  • Kevin Penner
    Hi Rebecca,

     

    Please see the .Net Fiddle for an example of how to format the query. https://dotnetfiddle.net/E9RYoi

     

    -Kevin
    0
  • Permanently deleted user
    Thanks Kevin. That makes sense logically but I'm still not forming the expression correctly. Here's what I tried (no judging!):

     

    "System ='"+ String.Format("System = {0} AND TYPE = 'Hydrant'", objWaterSys, "Hydrant") + "'"
    0
  • Kevin Penner
    Hi Rebecca,

     

    You really don't need any code outside of the String.Format call. All string manipulation can and should be done within that method.

     

    Also, to point out that the 'Hyrant' string is not being replaced.

     

    Try clause = String.Format("System = '{0}' AND TYPE = 'Hydrant'", objWaterSys) in an assign activity.

     

    -Kevin
    0
  • Permanently deleted user
    I changed it to this but still getting an error:

     

    User-added image
    0
  • Kevin Penner
    String.Format("System = '{0}' AND TYPE = 'Hydrant'", objWaterSys)
    0
  • Permanently deleted user
    Nevermind!  I was trying to use the text in the expression editor but when I assigned it to a string variable and used the string it worked. I still don't undertand why it wouldn't work directly in the expression editor for the where clause but it's working now!
    0

Du måste logga in om du vill lämna en kommentar.