无法从“十进制"转换为“参考十进制?" [英] cannot convert from 'decimal' to 'ref decimal?'

查看:552
本文介绍了无法从“十进制"转换为“参考十进制?"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何解决此问题
其实我想在SQL Server中插入numeric(18,0)值,但我正在传递十进制值,但出现此错误?
请问如何解决这个问题! 在此先感谢

how to solve this problem
actually i want to insert numeric(18,0) value in sql server and i am passing decimal value but getting this error ?
how to solve this problem plz help me!!!
thanks in advance

推荐答案



numeric(18,0)表示

一个数字,该数字的小数点前有18个(或更少)数字,小数点后有 0个数字.

请检查值中小数点后有多少位数(您正在传递插入).
Hi,

numeric(18,0) means

a number that has 18 (or less) digits before the decimal and 0 digits after the decimal.

Please check, how many digits are there after decimal in your value (That you are passing for insertion)..


如果您的代码如下所示:
If your code is like the following :
public void method(int i, ref decimal d)
{
...
}


然后,您必须像下面这样调用此方法,这样就不会收到您提到的错误:


Then you must call this method like the following so you wouldn''t get the error you mentioned:

...
decimal d = 9;
int i = 1;
method(i, ref d);
...


这篇关于无法从“十进制"转换为“参考十进制?"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆