2013-12-14 76 views

回答

1
String query = "Select * From Withdraw where CustID = ? AND AccountNo = ?"; 
PreparedStatment preparedStatement = conn.prepareStatement(query); 

preparedStatement.setString(1, aString); 
preparedStatement.setString(2, anotherString); 

rset = preparedStatement.executeQuery(); 

如果使用整數,有setInt(1, someInt)

的1個參數是?。 1第一?,2第二?

"... CustID = ? AND AccountNo = ? ..." 
       1     2 
+0

感謝,但什麼是數字 「1」 是指? – user3016854

+0

重讀答案,我解釋一下。 –

+0

這是否意味着我應該這樣寫: preparedStatement.setString(1,accNo);preparedStatement.setString(2,custID); – user3016854