here is my query:
select reporttime, datapath, finalconc, instrument from batchinfo
join qvalues on batchinfo.rowid=qvalues.rowid where qvalues.rowid
in (select rowid from batchinfo where instrument LIKE '%TF1%' and reporttime
like '10/%/2010%') and compound='ETG' and name='QC1'
i am running it like this:
// Create a database connection object using the connection string
OleDbConnection myConnection = new OleDbConnection(myConnectionString);
// Create a database command on the connection using query
OleDbCommand myCommand = new OleDbCommand(mySelectQuery, myConnection);
it does not return any results.
when i try this same query in sql server GUI it returns lots of rows
is there a problem specifically with the syntax of the query for c#?
please note that if i simplify the query like select * from table, there is no issue
Are you sure you are connecting to the same database in your code?
On a side note do you need the inner select? Couldn’t you write this query as follows.
select reporttime, datapath, finalconc, instrument from batchinfo join qvalues on batchinfo.rowid = qvalues.rowid where compound = 'ETG' and name = 'QC1' and batchinfo.instrument like '%TF1%' and batchinfo.reporttime like '10/%/2010%'