插入一條彩信

2021-05-23 16:18:32 字數 780 閱讀 2101

private void testinsertsms() {

final string address = "address";

final string date = "date";

final string read = "read";

final string status = "status";

final string type = "type";

final string body = "body";

int message_type_inbox = 1;

int message_type_sent = 2;

contentvalues values = new contentvalues();

/* 手機號 */

values.put(address, "13800138000");

/* 時間 */

values.put(date, "1281403142857");

values.put(read, 1);

values.put(status, -1);

/* 型別1為收件箱,2為發件箱 */

values.put(type, 2);

/* 簡訊體內容 */

values.put(body, "測試插入一條簡訊");

/* 插入資料庫操作 */

uri inserted = getcontentresolver().insert(uri.parse("content://sms"),

values);

取最後一條插入的資料

a2 hl x 10 09 14 排序後取最後一條啊 a2 hl x 10 09 39 你的id是遞增的還是隨機 a1 10 10 08 遞增a2 hl x 10 09 14 排序後取最後一條啊 a2 hl x 10 10 30 那就select max id from table a3 xx 10...

mysql 插入更新一條sql 搞定

插入資料時,我們經常會遇到這樣的情況 1 首先判斷資料是否存在 2 如果不存在,則插入 3 如果存在,則更新。在sql server中可以這樣處理 if not exists select 1 from t where id 1 insert into t id,update time values...

使用一條INSERT語句完成多表插入

這是一條顛覆常規的插入方法,一條insert語句可以完成向多張表的插入任務。小小地展示一下這種插入方法。1.建立表t並初始化測試資料,此表作為資料來源。sec ora10g create table t x number 10 y varchar2 10 sec ora10g insert into...