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. Delete Query String in Oledb

Delete Query String in Oledb

Scheduled Pinned Locked Moved C#
databasehelp
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.
  • P Offline
    P Offline
    pakFari
    wrote on last edited by
    #1

    hi, there are two query string i want to combine them string str = "xyz"; double waist = 123; string query1 = "delete from Trouser where Company = " + "'" + str + "'"; string query2= "delete from Trouser where Waist = " + waist ; i want to make them one using "where" clause. plz help me i will be very thankful to u.

    C 1 Reply Last reply
    0
    • P pakFari

      hi, there are two query string i want to combine them string str = "xyz"; double waist = 123; string query1 = "delete from Trouser where Company = " + "'" + str + "'"; string query2= "delete from Trouser where Waist = " + waist ; i want to make them one using "where" clause. plz help me i will be very thankful to u.

      C Offline
      C Offline
      Colin Angus Mackay
      wrote on last edited by
      #2

      If we ignore the gaping hole in the security of your application (May I suggest that you read SQL Injection Attacks and Tips on How to Prevent Them[^]) you can easily combine the two statements into one by using OR in the WHERE clause. e.g.

      DELETE FROM Trouser WHERE Company = 'abc' OR Waist = 123

      That will delete the row where any of the conditions are true. Compare this with AND where all the conditions must be true in order for the row to be deleted. Does this help?


      My: Blog | Photos WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and More

      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