chunkII123
IS-IT--Management
I have a Java application that uses -
<code>
"SELECT * FROM membersinformation WHERE membernumber = " +memberNumber;
</code>
Which works fine, but I added a code to add another column which will be called 'Age1', with an automatic calculation of the age via
<code>
CONCAT(CAST(IF(DATE_FORMAT(dateofbirth, '%m') < DATE_FORMAT(CURDATE(), '%m'), DATE_FORMAT(CURDATE(), '%Y') - DATE_FORMAT(dateofbirth, '%Y') + '0', DATE_FORMAT(CURDATE(), '%Y') - DATE_FORMAT(dateofbirth, '%Y') - '1') AS char)) AS 'Age1'
</code>
So the new Java call looks like -
<code>
"SELECT *, CONCAT(CAST(IF(DATE_FORMAT(dateofbirth, '%m') < DATE_FORMAT(CURDATE(), '%m'), DATE_FORMAT(CURDATE(), '%Y') - DATE_FORMAT(dateofbirth, '%Y') - '1', DATE_FORMAT(CURDATE(), '%Y') - DATE_FORMAT(dateofbirth, '%Y') + '0') AS char)) AS \"Age1\" FROM MembersInformation WHERE MemberNumber = " + memberNumber;
</code>
the problem is, when that same query is ran in MySQL query browser, it works like a charm, but when I try and use it in Java, the application (which has a dslField that pulls from 'Age1') that column 'Age1' not found.
Any help is apreciated as I have been extremely perplexed in trying to get this to work.
Beware of hackers bearing executables. Happy Hunting. 'irc.2600.net'
<code>
"SELECT * FROM membersinformation WHERE membernumber = " +memberNumber;
</code>
Which works fine, but I added a code to add another column which will be called 'Age1', with an automatic calculation of the age via
<code>
CONCAT(CAST(IF(DATE_FORMAT(dateofbirth, '%m') < DATE_FORMAT(CURDATE(), '%m'), DATE_FORMAT(CURDATE(), '%Y') - DATE_FORMAT(dateofbirth, '%Y') + '0', DATE_FORMAT(CURDATE(), '%Y') - DATE_FORMAT(dateofbirth, '%Y') - '1') AS char)) AS 'Age1'
</code>
So the new Java call looks like -
<code>
"SELECT *, CONCAT(CAST(IF(DATE_FORMAT(dateofbirth, '%m') < DATE_FORMAT(CURDATE(), '%m'), DATE_FORMAT(CURDATE(), '%Y') - DATE_FORMAT(dateofbirth, '%Y') - '1', DATE_FORMAT(CURDATE(), '%Y') - DATE_FORMAT(dateofbirth, '%Y') + '0') AS char)) AS \"Age1\" FROM MembersInformation WHERE MemberNumber = " + memberNumber;
</code>
the problem is, when that same query is ran in MySQL query browser, it works like a charm, but when I try and use it in Java, the application (which has a dslField that pulls from 'Age1') that column 'Age1' not found.
Any help is apreciated as I have been extremely perplexed in trying to get this to work.
Beware of hackers bearing executables. Happy Hunting. 'irc.2600.net'