0
我在我的android应用程序中有更新查询。但它没有正常工作。单击用于更新应用程序的按钮停止工作。代码如下 -更新查询在sqlite中不工作
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();
}
}
}
});
就是这样。我忘了添加单引号。它的工作现在。谢谢。 –
你应该接受答案,如果它对你有帮助,它将在未来帮助他人。 – Shraddha