insert into my_table_name (string_type_column_name1,
integer_type_column_name2) values('string_value1', 777)


On Mon, Oct 18, 2010 at 11:46 AM, pramod.deore <[email protected]>wrote:

> Hi, I had created a database and I am writing some values ino that
> database as.
>
> sampleDB.execSQL("INSERT INTO " +
>                                SAMPLE_TABLE_NAME +
>                                " Values ('s','m');");
>
> Then here the values are added as s and m respectively.It is fine. But
> now I don't want to use hard coded value like's' and 'm'. Now I have 2
> String as.
> String nm = "Pramod";
> String add = "deore";
>
> Now I want to add these 2 String to database. When I write code as
> sampleDB.execSQL("INSERT INTO " +
>                                SAMPLE_TABLE_NAME +
>                                " Values (nm,add');");
>
> Then I got error as -
> 10-18 15:15:14.464: ERROR/Database(21408): Failure 1 (no such column:
> s) on 0x2fb288 when preparing 'INSERT INTO App Values (s,m);'.
> 10-18 15:15:14.473: ERROR/ShowSwitches(21408): Could not create or
> Open the database.
>
> How to add String to database?
> Thanks
>
> --
> 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

-- 
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

Reply via email to