0

现在我在一个phoneGap项目中工作,在page1.html中我有以下代码将一些数据字段从page1.html保存到localDB,

tx.executeSql('CREATE TABLE IF NOT EXISTS tableOne (value1 INTEGER NOT NULL PRIMARY KEY, value2 INTEGER,value3 TEXT)');
tx.executeSql('INSERT INTO ICTtableOne (value1 ,value2,value3)VALUES (?,?,?)',[value1,value2,value3]);

在 page2.html 我有以下代码来保存 page2.html 中的数据字段

tx.executeSql('CREATE TABLE IF NOT EXISTS tableTwo (id INTEGER NOT NULL PRIMARY KEY, name  TEXT,Details TEXT,foreign_val int,FOREIGN KEY(foreign_val) REFERENCES tableOne(value1))');
tx.executeSql('INSERT INTO ICTtableTwo (value1 ,value2,value3)VALUES (?,?,?)',
        [value1,value12,value13]);

'tableOne' 的 Value1 是 'tableTwo' 中的外键,但每次插入后它没有显示在 'tableTwo' 中,它显示空白,因为 tableTwo 中的其他值都可以...我是初学者,所以我需要您的宝贵帮助...谢谢..

编辑: 如何在tableTwo 的foreign_val 列中获取tableOne 的主键值。

4

0 回答 0