如何运行查询长号

How to Run Query on Long number

大家好,我正在尝试 运行 对一个长数字进行简单查询,我已经尝试过,但仍然 returns 我的 ID 类型是长整型。我正在获取一个 jTable 的所有数据并且第一列是 id 当我点击该行时它总是给我这个异常并且我在控制台

中打印时从 table 获得了正确的值
java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.

我的代码是:

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);

去掉周围的单引号 '" + Long.parseLong(tableValue) + "'"