javascript - Azure 移动应用 Nodejs 后端提供的数据类型无效
问题描述
我正在尝试在表中插入一行。这是我所做的步骤:
我在数据库中运行 Create table Statement 来创建表测试
Create table test4
(
id int primary key identity (1, 1),
name nvarchar(100)
)
然后我转到应用服务编辑器并创建名为 test4.js 的文件 javascript
var table = module.exports = require('azure-mobile-apps').table();
然后我转到我的 API 并执行插入逻辑:
var test = {
name: "test country1",
};
req.azureMobile.tables('test4')
.insert(test)
.then(() => res.send({
status: config.get('statusResponse.success'),
token: 'token'
})).catch(error => {console.log("error " + error)});
我不知道为什么我得到这个错误。
error 错误:提供的数据类型无效
我更新我的问题
当我使用 Azure 的 Easy 表创建表时,我可以将记录插入表中,但我想使用我用 tsql 创建的存在表
解决方案
error 错误:提供的数据类型无效
根据您提供的创建表的语句:
Create table test4
(
id int primary key identity (1, 1),
name nvarchar(100)
)
作为ZUMO.V2(Azure 移动应用程序)的 30 天:第 6 天 - 个人表格提到了系统字段:
'id' 字段是一个字符串——它可以是任何东西,但它必须是唯一的,因为 id 是主键。如果未指定,Azure 移动应用会将 v4 GUID 的字符串表示形式分配给此字段。
推荐阅读
- javascript - AngularJS/Sharepoint 路由
- javascript - 无法从输入类型文件的反应中获取文件对象的长度
- java - 在java中加载图像后FPS下降
- arrays - 在c ++中将递归代码转换为将字符串反转为迭代代码
- javascript - 传单 js 添加/删除
- reactjs - 自定义 Highcharts desc 标签
- c++ - 如何关闭 QML/Javascript 代码中的窗口(涉及 C++ 代码)?
- compression - 对于随机内容的巨大目录(1 - 10TB)是否有任何好的 tar 压缩算法?
- java - Java Sockets not working on Android (ECONNREFUSED)
- android - 单击我的工具栏时出现 Nullpointer 异常错误