How could I write queries ?! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How could I write queries ?!

Some questions I founded how to write the queries too easily BUT the other questions I can’t understand what the questions mean 😔 .

28th Feb 2019, 4:05 AM
Lily🦋
Lily🦋  - avatar
1 Answer
+ 11
In android If you write queries in your database than follow this steps //getWritableDatabase() method provied you power to write data in your data base and this method return SQLiteDatabase Object. SQLiteDatabase i=helper.getWritableDatabase(); // if you use ContentValues class this class provied functionality to write data in specific row and coloum . ContentValues obj=new ContentValues(); obj.put(helper.NAME, name); obj.put(helper.ADDRESS, password); // her insert() method of class SQLiteDatabase helps to write data in specific table in this example my table name is TABLE_NAME in insert(Table name,String nullcoloumhack ,ContentValueObject) method you have to enter three value first is Table name second put null And third value put object of ContentValue and this method return long value. long id=i.insert(helper.TABLE_NAME, null, obj);
28th Feb 2019, 7:04 AM
Sumit Programmer😎😎
Sumit Programmer😎😎 - avatar