Is it possible in ADO to have a parameterised SQL statement that includes a UNION between tables? It looks like ADO.NET can, because the syntax is SELECT * FROM table1 WHERE col1 = @col1 UNION SELECT * FROM table2 WHERE col1 = @col1
so you can a parameter thuslyparameters.Add("@col1"...);
But ADO's syntax goes like this, if I understand correctly:SELECT * FROM table1 WHERE col1 = ? UNION SELECT * FROM table2 WHERE col1 = ?
in which case, when you add your parameter.CreateParameter("@col1"...)
it'll populate the first parameter, but not the second automagically, because it doesn't know they are the same one. I suppose you could add it a second time, but that seems a very inefficient way of doing things. Does anyone have a better suggestion (and stored procedures are not the answer in this case - this is a very dynamic query!)--"Life is like a sewer - what you get out of it depends on what you put into it"; Tom Lehrer