samedi 7 mars 2015

How to display sqlite particular column in android activity?

In using select * from table name it display all the columns in a table of sqlite.In case of *(Astriek) i replace a some column names,I can't able to fetch a data's. It works on sqlite but not work in android coding part.Please rectify those things



protected void adddata1() {
// TODO Auto-generated method stub
//tr1.removeAllViewsInLayout();


Database db=new Database(Boreport.this);
SQLiteDatabase sb=db.getReadableDatabase();

Cursor cus=sb.rawQuery("select boatname from Auction",null);// The problem Line

cus.moveToFirst();

for(int i=0;i<cus.getCount();i++)
{

if(cus.getString(0).toString().equalsIgnoreCase(boatno.getText().toString()))
{

bn.setText(cus.getString(1));

amount.setText(cus.getString(2));

}
cus.moveToNext();
}

Aucun commentaire:

Enregistrer un commentaire