我在gwt中有一个按钮,每次点击我想在数据库中增加该值。我该怎么做使用存储过程。它像按钮一样击中并增加特定帖子上的计数器。所有这些都需要新的帮助。
public String fun()
{
Connection con=null;
CallableStatement pt=null;
try
{
Class.forName("com.mysql.jdbc.Driver");
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/check", "root", "root");
pt=(CallableStatement)con.prepareCall("{call ask (1)}");
pt.executeUpdate();
System.out.println("2");
}
con.close();
pt.close();
}
catch(Exception e)
{
e.printStackTrace();
}
return"";
}
}
存储过程:
DELIMITER $$
CREATE DEFINER = root
@ localhost
程序ask
(IN good int)
开始
更新likepost set hitlike = hitlike + 1 where idlikepost = 1;
END
任务完成YIPEE !!!!
答案 0 :(得分:0)
首先将Window.alert("hello");
替换为e.printStackTrace()
以观看日志。
服务器端代码没有Window.alert("hello");
的含义。