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. Parameter passing to OleDb command

Parameter passing to OleDb command

Scheduled Pinned Locked Moved C#
databasesalesquestion
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.
  • J Offline
    J Offline
    jem9181
    wrote on last edited by
    #1

    I have two tables in my db. One is an invoice table and the other is a sales table. The sale table has all of the items on the invoices (referenced by invoice number). I want to grab specific invoices at a time (say 3 or more ) The best way I though to do this would be to use an IN statement in the where clause of the SQL stmt. Since I don't know how many I am going to need to grab, I was wondering if it was possible to pass one parameter to the IN clause ( a set of invoice numbers). Or would it be easier to just grab one at a time and append the result to my dataset? For instance: SELECT INVOICES.*, SALES.* FROM INVOICES INNER JOIN SALES ON INVOICE.invoice_number = SALES.invoice_number WHERE (Invoices.invoice_number IN (?)); Where ? could be {1002, 1004, 1100,...)

    N 1 Reply Last reply
    0
    • J jem9181

      I have two tables in my db. One is an invoice table and the other is a sales table. The sale table has all of the items on the invoices (referenced by invoice number). I want to grab specific invoices at a time (say 3 or more ) The best way I though to do this would be to use an IN statement in the where clause of the SQL stmt. Since I don't know how many I am going to need to grab, I was wondering if it was possible to pass one parameter to the IN clause ( a set of invoice numbers). Or would it be easier to just grab one at a time and append the result to my dataset? For instance: SELECT INVOICES.*, SALES.* FROM INVOICES INNER JOIN SALES ON INVOICE.invoice_number = SALES.invoice_number WHERE (Invoices.invoice_number IN (?)); Where ? could be {1002, 1004, 1100,...)

      N Offline
      N Offline
      n10sive
      wrote on last edited by
      #2

      instead of messing with parameters, why don't you just build the string in code and put it in the select command text before you execute it?

      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