我的libraryapp有一个小问题,所以我的控制台显示错误:在phpmyadmin中输入图像描述我创建了几个表:
书桌
用户表
我把他们连在一张table上:
借出table
带借出表的连接簿和用户
但是,当我想添加新的借出phpmyadmin它的工作完美。。。
下面是应该添加到应用程序和数据库的代码:
@Override
public boolean addLend(int userId, int bookId, String returnDate) {
try {
PreparedStatement preparedStatementInsert = connector.getPreparedStatement(
"INSERT INTO lend VALUES(?,?,?,?,?)");
preparedStatementInsert.setInt(1, 0);
preparedStatementInsert.setInt(2, userId);
preparedStatementInsert.setInt(3, bookId);
preparedStatementInsert.setString(4, returnDate);
preparedStatementInsert.setTime(5, null);
preparedStatementInsert.execute();
preparedStatementInsert.close();
return true;
} catch (SQLException e) {
e.printStackTrace();
}
return false;
}
private void tryAddLend() {
int userId = (textCustomeridAddLend.getText().trim().length());
int bookId = (textbookidAddLend.getText().trim().length());
String returnDay = textReturnDayAddLend.getText();
if (!checkAddLendData()) {
return;
}
if (mainDao.addLend(userId, bookId, returnDay)) {
Utils.createSimpleDialog("login", "", "added correctly");
} else {
Utils.createSimpleDialog("login", "", "error");
}
loadLends();
}
暂无答案!
目前还没有任何答案,快来回答吧!