大家好,我在编译代码时遇到错误,我不明白这是什么意思..我需要一些帮助..
在下面给出我的代码..
public String updateEntry(String empcode,String confirm_password)
{
String update="Update Signup set PASSWORD = '" + confirm_password + "' " + "
WHERE EMPLOYEE_CODE = " + " '" + empcode + "' ";
Cursor cursor=db.rawQuery(update, null);
String uppassword=cursor.getString(cursor.getColumnIndex("PASSWORD"));
return uppassword;
}
代码返回正确的输出......但存在错误......并且活动停止......
在下面给出我的logcat..
10-07 08:34:09.474: E/AndroidRuntime(21657): android.database.CursorIndexOutOfBoundsException: Index -1 requested, with a size of 0
10-07 08:34:09.474: E/AndroidRuntime(21657): at android.database.AbstractCursor.checkPosition(AbstractCursor.java:424)
10-07 08:34:09.474: E/AndroidRuntime(21657): at
android.database.AbstractWindowedCursor.checkPosition(AbstractWindowedCursor.java:136)
10-07 08:34:09.474: E/AndroidRuntime(21657): at android.database.AbstractWindowedCursor.getString(AbstractWindowedCursor.java:50)
10-07 08:34:09.474: E/AndroidRuntime(21657): at com.neochat.LoginDataBaseAdapter.updateEntry(LoginDataBaseAdapter.java:145)
10-07 08:34:09.474: E/AndroidRuntime(21657): at com.neochat.Forgotpassword.attemptforgot(Forgotpassword.java:157)
10-07 08:34:09.474: E/AndroidRuntime(21657): at com.neochat.Forgotpassword$1.onClick(Forgotpassword.java:54)
10-07 08:34:09.474: E/AndroidRuntime(21657): at android.view.View.performClick(View.java:4204)
10-07 08:34:09.474: E/AndroidRuntime(21657): at android.view.View$PerformClick.run(View.java:17355)
10-07 08:34:09.474: E/AndroidRuntime(21657): at android.os.Handler.handleCallback(Handler.java:725)
10-07 08:34:09.474: E/AndroidRuntime(21657): at android.os.Looper.loop(Looper.java:137)
10-07 08:34:09.474: E/AndroidRuntime(21657): at android.app.ActivityThread.main(ActivityThread.java:5041)
10-07 08:34:09.474: E/AndroidRuntime(21657): at java.lang.reflect.Method.invokeNative(Native Method)
10-07 08:34:09.474: E/AndroidRuntime(21657): at java.lang.reflect.Method.invoke(Method.java:511)
10-07 08:34:09.474: E/AndroidRuntime(21657): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
10-07 08:34:09.474: E/AndroidRuntime(21657): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
10-07 08:34:09.474: E/AndroidRuntime(21657): at dalvik.system.NativeStart.main(Native Method)