0
안녕하십니까. 긴 숫자에 대해 간단한 쿼리를 실행하려고합니다.하지만 여전히 id 형은 긴 정수입니다. 내가 행을 클릭 할 때 나는 항상 나에게이 예외를 제공하고 콘솔긴 숫자에 대한 쿼리를 실행하는 방법
java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.
내 코드에서 인쇄 할 때 내가 테이블에서 올바른 값을 가지고있다 JTable로하고, 1 열은 ID의 모든 데이터를 얻고있다 입니다 :
int row = recordsTable.getSelectedRow();
String tableValue = (recordsTable.getModel().getValueAt(row, 0).toString());
String qry = "Select * from records where id ='" + Long.parseLong(tableValue) + "'";
try {
db.setStmt((Statement) db.getCon().createStatement());
ResultSet rs = ((java.sql.Statement) db.getStmt()).executeQuery(qry);
if (rs.next()) {
id=rs.getLong("id");
idTextField.setText(Long.toString(id));
customerCode = rs.getString("customer_code");
custCodeTextField.setText(customerCode);
firstName = rs.getString("first_name");
firstTextField.setText(firstName);
lastName = rs.getString("last_name");
lastTextField.setText(lastName);
customerContact = rs.getString("customer_mobile");
custMobTextField.setText(customerContact);
customerAddress = rs.getString("customer_address");
custAddressTextField.setText(customerAddress);
fillComboBox();
area=rs.getString("area");
areaComboBox.setSelectedItem(area);
payment_this_month = rs.getInt("payment");
paymentTextField.setText(Integer.toString(payment_this_month));
duePayment = rs.getInt("balance");
balTextField.setText(Integer.toString(duePayment));
java.util.Date dateSet = rs.getDate("bill_issued_on");
billTextField.setText(dateSet.toString());
connectionStatus = rs.getString("connection_status");
jComboBox2.setSelectedItem(connectionStatus);
주위에 따옴표를 제거 –