我寫了下面的代碼:爲什麼在返回TRUE/FALSE到布爾類型時出錯?
import java.lang.*;
import DB.*;
private Boolean validateInvoice(String i)
{
int count = 0;
try
{
//check how many rowsets
ResultSet c = connection.DBquery("select count(*) from Invce i,cust c where tranid like '"+i+"' and i.key = c.key ");
while (c.next())
{
System.out.println("rowcount : " + c.getInt(1));
count = c.getInt(1);
}
if (count > 0) {
return TRUE;
} else {
return FALSE;
} //end if
}
catch(Exception e){e.printStackTrace();return FALSE;}
}
The errors I'm getting are:
i.java:195: cannot find symbol
symbol : variable TRUE
location: class changei.iTable
return TRUE;
i.java:197: cannot find symbol
symbol : variable TRUE
location: class changei.iTable
return FALSE;
i.java:201:: cannot find symbol
symbol : variable FALSE
location: class changei.iTable
catch(Exception e){e.printStackTrace();return FALSE;}
Connection類來自DB包我創建。
返回TRUE/FALSE是否正確,因爲該函數是布爾返回類型?
這奏效了,謝謝。 – phill 2010-03-31 22:29:00
@phil所以接受答案,好嗎? – 2010-03-31 22:42:04
我試過,但是它給了我一個消息,等待 – phill 2010-04-01 14:08:30