簡體   English   中英

如何從 Windows Azure 服務器腳本中插入的項目中獲取自動生成的 ID?

[英]How to obtain the auto-generated ID from an item being Insterted in a Server Scripts, Windows Azure?

我有一個表,“計划”,其中包含幾列和插入時自動生成的 ID 列。 當我在插入服務器腳本中工作時,我怎么知道 ID?。 我正在開發 windows azure 移動服務。

function insert(item, user, request) {
    //I want to know the ID of the new item to be inserted.
}

id 僅在項目插入數據庫時​​生成,並作為新屬性添加到item參數中。 您可以通過在插入操作中指定對腳本的回調來訪問它:

function insert(item, user, request) {
    request.execute({
        success: function() {
            var id = item.id;
            console.log("The new item's id is: ", id);
            request.respond();
        }
    });
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM