Saturday, 10 August 2013

no such column in sqllitedatabase

no such column in sqllitedatabase

Hello guys i am trying to read my database but it is giving me an error
which is "no such column : ders_adi" i tried everything but i couldnt get
rid of this damn thing.
private static final String TAG="Dbase";
public static final String KEY_ID_TB1 ="_ID";
public static final String KEY_DERS_TB1 ="ders_adi";
public static final String KEY_HARFNOTU ="harf_notu";
public static final String KEY_TOPLAMKREDI ="toplam_kredi";
public static final String KEY_HARFKREDI ="harf_kredi";
private static final String DB_NAME ="Transcript";
private static final int DB_VERSION =1;
private static final String DB_TABLE ="TB1";
private DbHelper myhelper;
private final Context mycx;
private SQLiteDatabase mydb;
SharedPreferences prefs;
private
public String show() { // TODO Auto-generated method stub
Cursor c = mydb.query(DB_TABLE,
new String [] { KEY_ID_TB1, KEY_DERS_TB1, KEY_HARFNOTU,
KEY_HARFKREDI,KEY_TOPLAMKREDI},
null, null, null, null, null);
String result = " ";
int idi = c.getColumnIndex(KEY_ID_TB1);
int derss = c.getColumnIndex(KEY_DERS_TB1);
int harfnotu = c.getColumnIndex(KEY_HARFNOTU);
int harfkredi = c.getColumnIndex(KEY_HARFKREDI);
int toplamkredi = c.getColumnIndex(KEY_TOPLAMKREDI);
for(c.moveToFirst(); !c.isAfterLast(); c.moveToNext()){
result=result + c.getString(idi) + " " + c.getString(derss) +
" " + c.getString(harfnotu) +
c.getDouble(harfkredi) + c.getDouble(toplamkredi) + " \n";
}
return result;

No comments:

Post a Comment