Web SQL 中的重复数据



如何使数据不重复 id 行如何自动插入

db.transaction(function (tx) {
    tx.executeSql('CREATE TABLE IF NOT EXISTS logins (Username, Password)');
});
db.transaction(function (tx) {
    tx.executeSql('INSERT INTO logins VALUES ("Ahmed","123")');
    tx.executeSql('INSERT INTO logins VALUES ("Ahmed","123")');
});
你可以

试试

db.transaction(function (tx) {
    tx.executeSql('CREATE TABLE IF NOT EXISTS logins (Username UNIQUE, Password)');
    tx.executeSql('INSERT INTO logins VALUES ("Ahmed","123")');
    tx.executeSql('INSERT INTO logins VALUES ("Ahmed","123")');
});

最新更新