simpson_121919
Newbie
I'm not sure how to query the TEXT datatype in my app. code. I have a table that has and integer column and when I query that I have no problems. When I try to query the TEXT columns I pass it in as a string in my app code but get an error saying "no such column".
Here is the code from when I try to pass it in as string -
public class DataBaseHelper extends SQLiteOpenHelper {
...
public Cursor getTitle(String mfg) throws SQLException
{
Cursor mCursor =
myDataBase.query(true, DATABASE_TABLE, new String[] {
KEY_ROWID,
KEY_gName
},
KEY_mfg + "=" + mfg,
null,
null,
null,
null,
null);
if (mCursor != null) {
mCursor.moveToFirst();
}
return mCursor;
}
MyActivity class code -
public class MyActivity extends Activity {
...
Cursor c = myDbHelper.getTitle("Capcom");
if (c.moveToFirst())
DisplayTitle(c);
else
Toast.makeText(this, "No title found",
Toast.LENGTH_LONG).show();
myDbHelper.close();
Here is the code from when I try to pass it in as string -
public class DataBaseHelper extends SQLiteOpenHelper {
...
public Cursor getTitle(String mfg) throws SQLException
{
Cursor mCursor =
myDataBase.query(true, DATABASE_TABLE, new String[] {
KEY_ROWID,
KEY_gName
},
KEY_mfg + "=" + mfg,
null,
null,
null,
null,
null);
if (mCursor != null) {
mCursor.moveToFirst();
}
return mCursor;
}
MyActivity class code -
public class MyActivity extends Activity {
...
Cursor c = myDbHelper.getTitle("Capcom");
if (c.moveToFirst())
DisplayTitle(c);
else
Toast.makeText(this, "No title found",
Toast.LENGTH_LONG).show();
myDbHelper.close();