使用 Azure 逻辑应用程序在 Azuresql 数据库中插入行

insert row in Azuresqldatabase by using Azure Logic Apps

我有 Azure SQL 数据库,我想使用逻辑应用程序执行插入、更新、删除操作 在连接到 Azure SQL DB 到 Logic -app 中的 Sqlserver Connector 时是否需要网关 我有三个属性 1)Id 2)Name 3)Department in Azure SqlDB

**When HTTP Request is Received Code:**
{
"headers": {
    "Accept": "application/json",
    "Content-Type": "application/json"
},
"properties": {
    "Department": {
        "type": "string"
    },
    "Name": {
        "type": "string"
    },
    "id": {
        "type": "integer"
    }
},
"type": "object"

} Http Request is Received

在 sql 连接器中显示错误请求: Insert -row Connector

Body 元素的属性为空

{ "Department": null, "Name": null,  "id": null  }

插入行连接符的输出 {

"statusCode": 400,
"headers": {
    "Pragma": "no-cache",
    "x-ms-request-id": "3332d425-3e10-4f04-b618-63f359168acc",
    "Strict-Transport-Security": "max-age=31536000; includeSubDomains",
    "X-Content-Type-Options": "nosniff",
    "X-Frame-Options": "DENY",
    "Timing-Allow-Origin": "*",
    "x-ms-apihub-cached-response": "false",
    "Cache-Control": "no-store, no-cache",
    "Date": "Mon, 04 May 2020 08:16:24 GMT",
    "Content-Length": "468",
    "Content-Type": "application/json",
    "Expires": "-1"
},
"body": {
    "status": 400,
    "message": "Microsoft SQL: Cannot insert the value NULL into column 'id', table '.dbo.Details'; column does not allow nulls. INSERT fails.\r\nclientRequestId: 3332d425-3e10-4f04-b618-63f359168acc",
    "error": {
        "message": "Microsoft SQL: Cannot insert the value NULL into column 'id', table 'dbo.Details'; column does not allow nulls. INSERT fails."
    },
    "source": "sql-eus2.azconn-eus2.p.azurewebsites.net"
}

}

注意:我没有使用任何网关,如果您有任何资源,请指导我完成上述任务,请告诉我 知道

逻辑应用程序定义: Designer

之前的错误历史: error:

我在有效载荷模式中传递的数据: enter image description here

发生此错误是因为您运行正在从 Azure 门户设置触发器。看到我 运行 触发器如下图所示, 我遇到以下错误 "Microsoft SQL: Cannot insert the value NULL into column 'id', table 'librarymanagement.dbo.DepartmentTable'; column does not allow nulls. INSERT fails."

要正确调用 HTTP 触发器逻辑应用程序,您需要对其进行 HTTP API 调用。如果你只是学习,你可以使用POSTMAN 来调用。以下是您需要执行的步骤

  1. 从门户复制 Logic APP url。

  2. 在 postman 和 select POST 方法中创建一个新请求并粘贴在步骤 1 中复制的 url。同时将 body 粘贴为显示。

  3. 现在移动到 Headers 并设置如下所示的值。

  4. 点击发送