Learn SQL first to deal with SQLite.
The problem with the code is that string values in SQL have to be
enclosed in single quotes.
DELETE FROM tablename where colname='SomeStringValue'
And change your code to proper code that does not have the SQL
injection problem:
myDB.execSQL("DELETE FROM tablename where colname= ? ",new Object[]
{string});
Read the following chapter: Using Databases
http://developer.android.com/intl/de/guide/topics/data/data-storage.html#db
At the end of it, there are 2 links to examples of complete
applications.
On 14 фев, 16:59, Abhilash baddam
<[email protected]> wrote:
> Hi,
>
> what type of mistake is i am doing?
>
> On Mon, Feb 14, 2011 at 8:11 PM, Abhilash baddam <
>
> [email protected]> wrote:
> > Hi,
>
> > In my code i used the command like this,* *
> > *
> > *
> > * myDB.execSQL("DELETE FROM tablename where colname="+string,null);*
>
> > In the place of args i am passing null, is it correct what exactly i have
> > to pass there.
>
> > On Mon, Feb 14, 2011 at 8:06 PM, Abhilash baddam <
> > [email protected]> wrote:
>
> >> Hi,
>
> >> i am getting that string, dynamically.
>
> >> On Mon, Feb 14, 2011 at 7:54 PM, Mark Murphy
> >> <[email protected]>wrote:
>
> >>> Use adb logcat, DDMS, or the DDMS perspective in Eclipse to examine
> >>> LogCat and look at your stack trace associated with your error.
>
> >>> In your case, you will find that you have invalid SQL, because your
> >>> string is not quoted. Please use:
>
> >>> String[] args={string};
> >>> myDB.execSQL("DELETE FROM tablename where colname=?", args);
>
> >>> On Mon, Feb 14, 2011 at 9:15 AM, Abhilash baddam
> >>> <[email protected]> wrote:
> >>> > Hi,
> >>> > In sqlite database, i am having some values. How can i delete a
> >>> > particular value from database. I tried like but showing error..
> >>> > What mistake is i am doin here..?
> >>> > myDB.execSQL("DELETE FROM tablename where colname="+string);
> >>> > i want to delete the value at that particulat string.
> >>> > Any help regarding this issue?
>
> >>> > --
> >>> > 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
>
> >>> --
> >>> Mark Murphy (a Commons Guy)
> >>>http://commonsware.com|http://github.com/commonsguy
> >>>http://commonsware.com/blog|http://twitter.com/commonsguy
>
> >>> Warescription: Three Android Books, Plus Updates, One Low Price!
>
> >>> --
> >>> 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
--
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