Dreamfactory REST API SQL存储过程转换错误(不允许从数据类型nvarchar到varbinary的隐式转换)

时间:2022-08-10 16:56:25

Attn. ADMIN please add dreamfactory as a tag, I cannot (not enough rep points).

经办人。 ADMIN请添加dreamfactory作为标签,我不能(没有足够的重复点)。

Bare with me as I am very new to this. I am using dreamfactory REST API to call a SQL Server stored procedure. The SQL Server database is using a user defined data type for a few of the parameters of the stored procedure.

和我在一起,因为我对此很陌生。我使用dreamfactory REST API来调用SQL Server存储过程。 SQL Server数据库使用用户定义的数据类型来存储存储过程的一些参数。

Here is how I am calling it via the API Docs area of Dreamfactory:

以下是我通过Dreamfactory的API Docs区域调用它的方法:

 {
 "params": [
      {
      "name": "Number",
      "param_type": "IN",
      "value": "123456"
      },
      {
      "name": "IdNumber",
      "param_type": "IN",
      "value": "0x0048F1F5A7DC5A2A431CBAD70270E59C5FA0"
     }
 ],
 "schema": {
 "_field_name_": ""
  },
 "wrapper": "",
 "returns": ""
  }

The error is:

错误是:

Implicit conversion from data type nvarchar to varbinary is not allowed

不允许从数据类型nvarchar到varbinary的隐式转换

I believe the problem is with the second parameter IdNumber which is the user-defined data type. If I delete the parameter I just get an error that IdNumber is expected and missing.

我认为问题在于第二个参数IdNumber是用户定义的数据类型。如果我删除参数,我只会收到IdNumber预期和丢失的错误。

The data type is a user defined type and I am not sure why it is trying to convert it to varbinary. I don't really know of any way to convert or store the value since it's using the REST API. Am I correct in thinking that I cannot cast or convert anything as a stored procedure parameter?

数据类型是用户定义的类型,我不确定为什么它试图将其转换为varbinary。我真的不知道转换或存储值的任何方法,因为它使用的是REST API。我是否认为我无法将任何内容转换或转换为存储过程参数?

I know this is a pretty specific problem but any help is appreciated. I have been fighting with dreamfactor a lot on this project and if the answer is to go in another direction I am open to that.

我知道这是一个非常具体的问题,但任何帮助表示赞赏。在这个项目中,我一直在与dreamfactor战斗,如果答案是向另一个方向发展,我会对此持开放态度。

2 个解决方案

#1


1  

I believe the reason that it's trying to convert it to varbinary is this:

我相信它试图将其转换为varbinary的原因是:

"value": "0x0048F1F5A7DC5A2A431CBAD70270E59C5FA0"

I believe the leading 0x in the value is triggering it. Typically, a value that starts with 0x is considered a Hexadecimal value.

我相信值中的前导0x触发它。通常,以0x开头的值被视为十六进制值。

I am not familiar with MS SQL Server, however, if you do not intend to allow the user defined data type to be binary, perhaps you could filter the input to not allow a leading 0x.

我不熟悉MS SQL Server,但是,如果您不打算允许用户定义的数据类型为二进制,也许您可​​以过滤输入以不允许前导0x。

Hope this helps

希望这可以帮助

#2


0  

After working with Dreamfactory tech support this is an issue with Dreamfactory that they hope to have resolved soon.

在与Dreamfactory技术支持部门合作之后,这是Dreamfactory的一个问题,他们希望尽快解决。

#1


1  

I believe the reason that it's trying to convert it to varbinary is this:

我相信它试图将其转换为varbinary的原因是:

"value": "0x0048F1F5A7DC5A2A431CBAD70270E59C5FA0"

I believe the leading 0x in the value is triggering it. Typically, a value that starts with 0x is considered a Hexadecimal value.

我相信值中的前导0x触发它。通常,以0x开头的值被视为十六进制值。

I am not familiar with MS SQL Server, however, if you do not intend to allow the user defined data type to be binary, perhaps you could filter the input to not allow a leading 0x.

我不熟悉MS SQL Server,但是,如果您不打算允许用户定义的数据类型为二进制,也许您可​​以过滤输入以不允许前导0x。

Hope this helps

希望这可以帮助

#2


0  

After working with Dreamfactory tech support this is an issue with Dreamfactory that they hope to have resolved soon.

在与Dreamfactory技术支持部门合作之后,这是Dreamfactory的一个问题,他们希望尽快解决。