I'm doing a bit of .Net work for a client who in turn wants to roll it out to several of their clients.
All the end customers have the same (SQL Server) database, but the schema the tables live in varies.
It's a real noddy little app, and I've dealt with it by putting the queries directly into the code,
e.g.
select ordernumber, orderdate, blah
from [SCHEMA].[Order]
Where
clientId = @ClientId
then doing a string Replace on "SCHEMA" with a value from the config file.
This works, but doesn't seem like a great solution.
If I create a SqlDataSource, it seems to allow me to run a replace on the SelectCommand.
But if I use a TableAdapter (which is what I'd like to use - and was using before I realised they had different schemas) I can't access the underlying query through code.
I've found some stuff about extending the TableAdapter but it doesn't seem to resolve my issue - I just want to access the original query and stick in my schema.
I'm not going to fret too much over it, but wondered if anyone can suggest a better (and simple) solution?
All the end customers have the same (SQL Server) database, but the schema the tables live in varies.
It's a real noddy little app, and I've dealt with it by putting the queries directly into the code,
e.g.
select ordernumber, orderdate, blah
from [SCHEMA].[Order]
Where
clientId = @ClientId
then doing a string Replace on "SCHEMA" with a value from the config file.
This works, but doesn't seem like a great solution.
If I create a SqlDataSource, it seems to allow me to run a replace on the SelectCommand.
But if I use a TableAdapter (which is what I'd like to use - and was using before I realised they had different schemas) I can't access the underlying query through code.
I've found some stuff about extending the TableAdapter but it doesn't seem to resolve my issue - I just want to access the original query and stick in my schema.
I'm not going to fret too much over it, but wondered if anyone can suggest a better (and simple) solution?