我的 android 应用程序中有一个更新查询。但它不能正常工作。单击用于更新应用程序的按钮时停止工作。代码如下——
update.setOnClickListener(new OnClickListener (){
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
String feched_name = show_name.getText().toString();
String get_std_for_update=id_search.getText().toString();
String get_new_name = id_update.getText().toString();
if(feched_name.matches("")){
Toast.makeText(getApplicationContext(), "No Student selected", Toast.LENGTH_LONG).show();
}
else {
if(get_new_name.matches("")){
Toast.makeText(getApplicationContext(), "New Name is empty", Toast.LENGTH_LONG).show();
}
else{
stdDB.execSQL("Update student set name = "+get_new_name + "where id = "+get_std_for_update);
Toast.makeText(getApplicationContext(), "Student's name has been updated", Toast.LENGTH_LONG).show();
}
}
}
});