正在开发 Windows 商店 javascript 应用程序。该应用程序通过移动服务与 Azure 集成。我想删除与特定 ID 匹配的特定记录。
假设表(项目)中有四列(编号,名称,标题,消息,id)
我想删除 id=5 且 title='stackoverflow' 的整行。什么代码将执行该操作?
最佳答案
鉴于您引用了 table对象,您需要从表中获取实际行,然后只需调用 del(item, callback) table
对象上的方法。您可以从已检索的对象列表中获取实际行,或使用 where method得到它。
类似于:
var myTable = client.getTable('MyItem');
// here is a code to get the actual item
myTable.del(item);
或更简单的:
myTable.where({ id: 5, titile: "stackoverflow" })
.read()
.done(function (results) {
var result = results[0];
if (result != null && typeof (result) != "undefined") {
todoTable.del(result);
}
});
关于javascript - 如何从azure数据库的表中删除行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15771237/