【发布时间】:2017-04-06 08:31:42
【问题描述】:
我是 android 开发新手,我正在创建一个 android 应用程序。
当用户点击登录时,我应该在我的数据库中收到它的数据。
我认为我的 android 数据库连接有问题:当我点击登录时,我的数据库中没有收到任何数据。
我使用 XAMPP 作为数据库。
login.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
try {
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection(url, user, pass);
String result = "Database connection successful";
PreparedStatement ps = con.prepareStatement("Insert into login VALUES(?, ?)");
ps.setString(1, email.getText().toString());
ps.setString(2, password.getText().toString());
ps.executeUpdate();
} catch (ClassNotFoundException e) {
e.printStackTrace();
} //end of insert button calling
catch (SQLException e) {
e.printStackTrace();
}
//to Fetch the Record
//finish();
login();
}
});
【问题讨论】:
-
我希望当用户点击登录进入我的应用程序时,我会在我的管理页面上收到它
-
基本上我想让我的 xampp 数据库与 android 连接..
-
您在数据库中添加了一些记录。您添加了一个额外的查询。
-
不,我不是印度人
-
好的,你的登录脚本语言是什么。