Select Query of Access database
Posted on 2011-03-22
I have developed an application in java with Access database.
In that I am using select query as
ResultSet rs = stmt.executeQuery("select stestid,mtestid,stestname,"+docid+" from Subtest");
Here I have table 'subtest' which contains columns stestid,mtestid,stestname,1,2,3,4,5,6,7,8,9,10,11
I want to select value from one of the column 1,2,3,4,5,6,7,8,9,10,11 dynamically. Thats why I took variable 'docid' for same.
But if I take docid=1 or anything between 1,2,3,4,5,6,7,8,9,10,11 I get wrong result.
e.g. If I take docid=5 then it results '5' insteade of value from table '5'. Please help
Added MS Access and SQL Syntax zones
Access Zone Advisor