如何存储在使用jQuery移动dreamviewer CC与Android的PhoneGap的SQLite数据库的数据? [英] How to store data in sqlite database using jQuery-mobile dreamviewer cc with phonegap in android?
问题描述
我在用手机隙开发Android应用程序在Dreamweaver CC新。我在那个有4个领域我需要存储在SQLite数据库这个领域设计的简单形式?在Eclipse导入SQLite数据库与开放数据库连接,然后创建表和存储数据。这是工作的罚款,我需要在Dreamweaver CC这里做一样的吗?
Am new in developing android app in Dreamweaver CC with Phone-gap. I designed simple form in that having 4 fields I need to store this fields in sqlite database? In eclipse import sqlite database and open database connection and then create table and store data. This is working fine, I need to do same here in Dreamweaver CC?
import android.database.sqlite.SQLiteDatabase;
SQLiteDatabase db;
db = this.openOrCreateDatabase("QAOD", MODE_PRIVATE, null);
db.execSQL("INSERT INTO TableName(Id) VALUES(18)");
此格式code是工作在Eclipse的Android精品,但我需要在Dreamweaver CC使用code和数据存储在sqlite的与电话隙。帮助我,或建议我来存储数据。
This format code is working fine in eclipse android but I need use this code and store data in sqlite in Dreamweaver CC with Phone-gap. Help me or suggest me to store data.
推荐答案
您提到您正在使用的PhoneGap
。这些都是建立在Android的记录添加到 SQLite数据库
的步骤
You mentioned you are using Phonegap
. These are the steps to create and add records to sqlite database
in Android
第一步:添加插件
cordova plugin add https://github.com/brodysoft/Cordova-SQLitePlugin
二:打开数据库
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
var db = window.sqlitePlugin.openDatabase({name: "my.db"});
}
第三:使用它(创建,更新或删除)
db.transaction(function(tx) {
tx.executeSql('DROP TABLE IF EXISTS test_table');
tx.executeSql('CREATE TABLE IF NOT EXISTS test_table (id integer primary key, data text, data_num integer)');
// demonstrate PRAGMA:
db.executeSql("pragma table_info (test_table);", [], function(res) {
console.log("PRAGMA res: " + JSON.stringify(res));
});
您可以阅读更多这里...
这篇关于如何存储在使用jQuery移动dreamviewer CC与Android的PhoneGap的SQLite数据库的数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!