Add a second parameter to insert(), and add a second invocation of
bindString().

On Mar 5, 2:53 pm, "[email protected]" <[email protected]>
wrote:
> HI,
>
> I am new to android and I am experimenting with sqlite.  I would like
> to extend my  SQL insert statement so I can insert into more than one
> row.
>
> I have extended my table as follows including a column called actor
>
> db.execSQL("CREATE TABLE " + TABLE_NAME + "(id INTEGER PRIMARY KEY,
> name TEXT, actor TEXT");
>
> I am using SQLiteStatement and would like to extend the insert to
> include actors along with names
>
> private static final String TABLE_NAME = "testtable ";
>
>         private SQLiteStatement insertStmt;
>         private static final String INSERT = "insert into "
>               + TABLE_NAME + "(name) values (?)";  <----------------
> where is
> name coming from ??
>
> This is my insert function, but how can I call it and execute an
> INSERT to include the column actor
>
> public long insert(String name) {
>  this.insertStmt.bindString(1, name);
> return this.insertStmt.executeInsert();
>                            }
>
> call to use insert
>
> this.dh.insert("Inception");
>
> I would like to change this to
>
> this.dh.insert("Inception", "Leo");
>
> Thank you
>
> Graham

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