开发者

how can I insert a row in my database from 'adb shell'

I can connect to my android database using 'sqlite3' command. So I get a 'sqlite' prompt, like this:

And I create a table like this:

sqlite> .schema
CREATE TABLE table1 (id INTEGER PRIMARY KEY, name TEXT, test1 TEXT);

My question: how can I use sqlite command t开发者_StackOverflow中文版o insert a row in that table?

Thank you.


yes if you are able to create table then it is simple to add row in that table. use below line in your sqlite command prompt.

INSERT INTO table1 values(1,'Name1','test1');
INSERT INTO table1 values(2,'Name2','test2');

Now if you want to check if the values are inserted in database or not use

SELECT * FROM table1;

and you are done.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜