SqlDataReader and Unions
C#
1
Posts
1
Posters
0
Views
1
Watching
-
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.