【问题标题】:HTML5 Web SQL Database INSERT into table fail when hosted from IIS server从 IIS 服务器托管时,HTML5 Web SQL 数据库插入表失败
【发布时间】:2012-03-07 13:19:23
【问题描述】:

当托管在本地 IIS 7 服务器上时,INSERT into 表将不起作用。但是,当从 Visual Studio 2010 通过 ASP.NET 开发服务器运行时,它将起作用。创建了数据库和表,但 INSERT 查询似乎什么都不做。我没有从执行 INSERT 查询本身得到任何错误消息,并且事务没有失败。我正在使用 Safari 浏览器和 Safari 的 Inspect Element 来尝试调试问题。任何想法将不胜感激。见代码:

try {
    systemDB.transaction(function (tx) {
    tx.executeSql('INSERT INTO tblReminders (fldForeignId, fldReminderContent,        fldReminderDate, fldActioned, fldReminderTime, fldSubject, fldDueDate, fldBusinessBaseId, fldMobileRecipientsOnly, fldSendToCoordinator, fldPersonIds) ' +
          'VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);', [foreignId, reminderContent, reminderDate, actioned, reminderTime, subject, dueDate, businessBaseId, mobileRecipientsOnly, sendToCoordinator, personIds], dataHandler, sqlErrorHandler);
    }, myTransactionErrorCallback, myTransactionSuccessCallback("INSERT INTO tblReminders:"));
} catch (e) {
    alert(getDatabaseErrorCodes(-1, e));

    return;
}

【问题讨论】:

    标签: sql html iis


    【解决方案1】:

    因为这是一个本地网络数据库,插入应该发生。这应该独立于服务器。

    Q1:您遇到的错误是什么? Q2:你打开数据库正确吗?

    executeSQL 方法需要以下格式的输入

    tx.executeSql(sql, data, resultHandler, errorHandler);
    

    如果您没有类似的东西,我建议以下作为错误回调:

    function errorHandler(transaction, error) {
        log.error("database error", transaction, error);
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-02-08
      • 1970-01-01
      • 1970-01-01
      • 2012-04-02
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多