0
我做這樣的如何找到重複的價值是插入到Android的sqllite?
public void insertNewCustomere(NewCustomer ncust) {
ContentValues values = new ContentValues();
values.put("cname", ncust.cName);
values.put("date", ncust.date);
values.put("caddress", ncust.cAddress);
mdb.insert(CREATE_NEWCUSTOMER, null, values);
if(mdb.insert(CREATE_NEWCUSTOMER, null, values)==-1)
{
Toast.makeText(this, "Name already exist", Toast.LENGTH_LONG)
.show();
ContentValues values1 = new ContentValues();
}
else
{
Toast.makeText(this, " \n Details Submited Successfully.Thank You", Toast.LENGTH_LONG)
.show();
ContentValues values2= new ContentValues();
}
}
我使用的名稱column.how主鍵查找同名進入第二次。 – sai 2012-02-13 10:06:17
捕獲主鍵違例異常。 http://stackoverflow.com/questions/1988570/how-to-catch-a-specific-exceptions-in-jdbc - 違反完整性約束 – 2012-02-13 10:07:49