Using IDataReader in c# to pull a list of host names from a database that correspond to a specific business unit, but can't figure out what is wrong. I am guessing that there are too many arguments in the SQL statement, or perhaps the ExecuteReader method here should not be used. I cannot create a SP in the target DB so I am left with running the query in some other manner. Any help will be greatly appreciated.
public static IDataReader GetCETHostsList()
{
string mySQL = @"SELECT distinct(dbo.Infrastructure.Hostname) dbo.Application_Infrastructure
INNER JOIN dbo.Applications ON dbo.Application_Infrastructure.ID = dbo.Applications.ID
INNER JOIN dbo.Infrastructure ON dbo.Application_Infrastructure.InfrastructureID = dbo.Infrastructure.InfrastructureId
WHERE Unit is not null
AND dbo.Applications.Unit like '%Terminal%'
AND (dbo.Infrastructure.Hostname like '%ST%' or dbo.Infrastructure.Hostname like '%TR%' )";
return DatabaseFactory.CreateDatabase("myDB").ExecuteReader(mySQL);
}