public class MainActivity implements TimePickerDialog.OnTimeSetListener {
...
@Override
public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
Toast.makeText(this, "chosen hour of day: " + hourOfDay, Toast.LENGTH_LONG).show();
}
}
它显示的异常是“参数索引超出范围(1>参数数量,为0)”。请帮忙!!!
答案 0 :(得分:3)
替换此:
"INSERT into user_info (username,password,email_id,mobile number) VALUES('"+user+"','"+pass+"','"+email+"','"+mb+"')";
由此:
"INSERT into user_info (username,password,email_id,mobile_number) VALUES(?, ?, ?, ?)";
您将在以后按相应顺序插入值
myStat.setString(1, user);
myStat.setString(2, pass);
myStat.setString(3, email);
myStat.setString(4, mb);
答案 1 :(得分:1)
由于您使用了准备好的语句,请更改为:
String query="INSERT into user_info (username,password,email_id,`mobile number`) VALUES(?,?,?,?)";
稍后将在所有对setString()
方法的调用中插入参数。
编辑,如果该列的名称为mobile number
,则在select语句中输入
`手机号码或 [手机数字]