从 IIS 服务器托管时,HTML5 Web SQL 数据库插入表失败

发布于 2024-12-26 10:48:16 字数 938 浏览 0 评论 0原文

当托管在本地 IIS 7 服务器上时,插入表将不起作用。然而,当从 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;
}

The INSERT into table will not work when hosted on a Local IIS 7 server. However it will work when running through the ASP.NET Development Server from Visual Studio 2010. The database and table are created but the INSERT query seems to just do nothing. I'm not getting any error messages back from executing the INSERT query itself and the transaction is not failing. I'm using the Safari browser and Safari's Inspect Element to try and debug the issue. Any ideas would be greatly appreciated. See code:

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;
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

朱染 2025-01-02 10:48:16

由于这是本地 Web 数据库,因此应该进行插入。这应该独立于服务器。

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

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

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

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

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

Since this is a local web database, the insert should happen. This should be independent of the server.

Q1: What is the error you are getting?
Q2: Are you opening the database correctly?

The executeSQL method requires the inputs in the following format

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

I suggest the following as the error callback if you don't have something similar:

function errorHandler(transaction, error) {
    log.error("database error", transaction, error);
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文