Try following code snippet... it should work...

public Cursor getStartLatitude(String trackname) throws SQLException
{
*String[] FROM = {KEY_ROWID3, KEY_TRACKNAME, KEY_STARTPOSITION, };*
* **String[] param = {"kingsav"};*

Cursor mCursor = mDb.query(true, DATABASE_TABLE3, *FROM*, *KEY_TRACKNAME +
"=" +"?"*,
*        param*, null, null, null, null);

if (mCursor != null)
{
       mCursor.moveToFirst();
   }

   return mCursor;
}


On Mon, Mar 29, 2010 at 8:16 PM, Sonic <[email protected]> wrote:

> Hi all,
>
> I need urgent help with a simple selection I am having difficulty
> with.
>
> I am trying to return a value of a Double called startPosition, where
> trackName is equal to a name of a string.
>
> The query doesnt seem to be returning anything, here is the code from
> my DbAdapter.
>
> Java:
>
>    public Cursor getStartLatitude(String trackname) throws
> SQLException {
>
>        Cursor mCursor =
>
>            mDb.query(true, DATABASE_TABLE3, new String[] {KEY_ROWID3,
> KEY_TRACKNAME,
>                    KEY_STARTPOSITION}, KEY_TRACKNAME + "=" +
> "'kingsav'",
>                    null, null, null, null, null);
>    if (mCursor != null) {
>        mCursor.moveToFirst();
>    }
>    return mCursor;
>
>    }
>
>
>
> And here is my code from the Java code that passes in the value and
> reads it to a textview. Note above, I have used a static value for
> testing purposes.
>
>
> Java:
> private void loadTrackInfo()
>     {
>          Cursor b = mDbHelper.getStartLatitude(TrackName);
>     if(b.moveToFirst())
>     {
>
>          Double startLocation =
> b.getDouble(b.getColumnIndex(mDbHelper.KEY_STARTPOSITION));
>
>          selectedTracktv.setText("Active Track: "+startLocation);
>
>     }
>
>
>
>     }
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]<android-developers%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>
> To unsubscribe from this group, send email to android-developers+
> unsubscribegooglegroups.com or reply to this email with the words "REMOVE
> ME" as the subject.
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

To unsubscribe from this group, send email to 
android-developers+unsubscribegooglegroups.com or reply to this email with the 
words "REMOVE ME" as the subject.

Reply via email to