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. SqlDataReader and Unions

SqlDataReader and Unions

Scheduled Pinned Locked Moved C#
databasehelpquestioncareer
1 Posts 1 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.
  • D Offline
    D Offline
    dwolver
    wrote on last edited by
    #1

    I have some sql say select * from (Select 'JOB'[deadlineSource],yadda yadda) A union select * from (select 'TEST'[deadlineSource],yadda yadda) B which works just fine in sql Management studio. I prep my sql command SqlConnection connection = new SqlConnection(connectionString); connection.Open(); SqlCommand command = connection.CreateCommand(); command.CommandTimeout = 6000; command.CommandText = sqlTxt; SqlDataReader reader = command.ExecuteReader(); at which point an exception gets thrown. Is there some issue with trying to do unions selects with sqlDataReader? The exception is something an "Invalid object name 'Test' which kind of tells me that it doesn't like the column [deadlineSource] i'm using.

    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