Android的SQLite的插入或更换 [英] Android SQLite INSERT or REPLACE

查看:148
本文介绍了Android的SQLite的插入或更换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图插入或SQLite中没有成功,到目前为止,因为没有行被插入REPLACE语法。

I am trying the INSERT OR REPLACE syntax in SQLite with no success so far because no rows are inserted.

我创建表的查询是

 create table providers (provider_id text not null, provider_name text not null,  provider_channel_id text not null, channel_name text not null);CREATE UNIQUE INDEX channel_id ON providers (provider_channel_id);

我的插入或更换查询

My INSERT OR Replace query is

INSERT OR REPLACE INTO providers (provider_channel_id, channel_name, provider_id, provider_name) VALUES ('1', '2', '3', '4')

感谢

推荐答案

看看这个帖子:(假设你已经审查Sieryuu的评论)

Look at this post: (assuming you have reviewed Sieryuu's comment)

<一个href=\"http://stackoverflow.com/questions/690632/how-do-i-update-a-row-in-a-table-or-insert-it-if-it-doesnt-exist\">How我更新行的表或插入,如果它不存在?

您应该能够只需更换一行。

you should be able to just replace a row.

这篇关于Android的SQLite的插入或更换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆