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. .NET (Core and Framework)
  4. ASP.NET not executing Oracle query

ASP.NET not executing Oracle query

Scheduled Pinned Locked Moved .NET (Core and Framework)
databasecsharpcssasp-netoracle
2 Posts 2 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.
  • H Offline
    H Offline
    Hammad Mansoor
    wrote on last edited by
    #1

    Hi all When I execute this query in Oracle I get perfect results. 1. SELECT * FROM TOTAL_CASES 2. WHERE (TRIM("NTN") = TRIM(:NTN) 3. OR '%'||upper("NAME")||'%' LIKE '%'||upper(:NAME)||'%') 4. AND (upper(TRIM("STATUS")) LIKE nvl(upper(TRIM(:STATUS)),'%'||''||'%')) It means that if :STATUS is NULL then give all results matching step 3 or 4. If there is a value for :STATUS then also filter results according to that value. This query gives accurate results when executed in SQL. However, I also use this to populate a Data Grid in ASP.NET. When STATUS is NULL in ASP.NET, the Data Grid shows no results. However, when I select value for the STATUS, then it shows results according to the value chosen for STATUS. Please help me as to how to populate Data Grid when I select no value for STATUS. Thanks. Hammad

    K 1 Reply Last reply
    0
    • H Hammad Mansoor

      Hi all When I execute this query in Oracle I get perfect results. 1. SELECT * FROM TOTAL_CASES 2. WHERE (TRIM("NTN") = TRIM(:NTN) 3. OR '%'||upper("NAME")||'%' LIKE '%'||upper(:NAME)||'%') 4. AND (upper(TRIM("STATUS")) LIKE nvl(upper(TRIM(:STATUS)),'%'||''||'%')) It means that if :STATUS is NULL then give all results matching step 3 or 4. If there is a value for :STATUS then also filter results according to that value. This query gives accurate results when executed in SQL. However, I also use this to populate a Data Grid in ASP.NET. When STATUS is NULL in ASP.NET, the Data Grid shows no results. However, when I select value for the STATUS, then it shows results according to the value chosen for STATUS. Please help me as to how to populate Data Grid when I select no value for STATUS. Thanks. Hammad

      K Offline
      K Offline
      Kalyan_A
      wrote on last edited by
      #2

      hi hammad it is possible that your page is passing a blank string instead of NULL to the query. check if the following works in line 4

      AND (upper(TRIM("STATUS")) LIKE ('%' || upper(TRIM(nvl(:STATUS,'%')) || '%')

      i havent been able to check it but hope that helps.

      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