找到你要的答案

Q:Dreamfactory REST API SQL stored procedure conversion error (Implicit conversion from data type nvarchar to varbinary is not allowed)

Q:dreamfactory REST API的SQL存储过程转换误差(数据类型为nvarchar VarBinary隐式转换是不允许的)

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

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.

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

 {
 "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

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.

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?

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.

经办人。管理员请加dreamfactory作为一个标签,我不能(没有足够的代表点)。

赤裸与我,因为我是非常新的。我用dreamfactory REST API调用SQL Server存储过程。SQL Server数据库是使用用户定义的数据类型的几个存储过程的参数。

这就是我要通过Dreamfactory的API文档区:

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

错误是:

从数据类型为nvarchar VarBinary隐式转换是不允许的

我认为问题是第二参数的ID号,这是用户定义的数据类型。如果我删除我只得到一个错误的ID号,预计和失踪的参数。

数据类型是用户定义的类型,我不知道为什么它是试图将其转换为varbinary。我真的不知道任何方法来转换或存储的值,因为它使用的其余API。我认为我不能作为存储过程参数转换或转换任何东西,我是正确的吗?

我知道这是一个非常具体的问题,但任何帮助。我一直战斗dreamfactor很多这样的项目,如果答案是去另一个方向我敞开。

answer1: 回答1:

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

"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.

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.

Hope this helps

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

"value": "0x0048F1F5A7DC5A2A431CBAD70270E59C5FA0"

我相信价值的0x是触发它。通常,一个价值开始0x是十六进制值。

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

希望这有助于

answer2: 回答2:

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

工作dreamfactory技术支持这是一个Dreamfactory,他们希望能尽快解决问题后。

sql-server  rest  stored-procedures