0
//creating a resultset + connecting with the connection method and typing in query
ResultSet rowCount = MainApp.dataBaseSelect("SELECT COUNT(isFoundStatus) FROM damageclaim");
//creating int variable but needs a value since in later row it says ' might not be initalized '
int rowCountInt = 0;
//giving the resultset to the int.
while (rowCount.next()){
rowCountInt = rowCount.getInt("isFoundStatus");
}
//testing with system out
System.out.println(rowCountInt);
데이터베이스 행의 길이를 가져오고 싶지만 데이터베이스에 대한 다른 연결이 작동하는 반면 어떤 이유로 작동하지 않습니다.SELECT COUNT 쿼리가 작동하지 않는 이유는 무엇입니까?
오류가 나는 얻을 : 컬럼을 찾을 수 없습니다, 나는 정말 그것을 가지고 ... 비록
일이 문제의 적절한 설명 "하지 않는다"아니다. 정확하게 작동하지 않는 것을 알려주고 질문에 필요한 모든 코드를 포함 시키십시오 (예를 들어'MainApp' 클래스). – BackSlash
rowCount.getInt (1)과 같이 인덱스를 사용하면 작동한다고 가정합니다. 이름으로 액세스하려면 쿼리의 열 이름을 "SELECT COUNT (isFoundStatus) as isFoundStatus FROM ..."과 같이 지정해야합니다. – EdmCoff
'count (isFoundStatus)'가 어떻게 든 자동으로 별칭'isFoundStatus'를 상속 받았다고 가정합니다 (적어도 현재 사용하고있는 데이터베이스에는없는). –