为Numeric(18,0)添加参数SqlDbType吗? [英] Adding Parameter, SqlDbType for Numeric(18,0) ?

查看:67
本文介绍了为Numeric(18,0)添加参数SqlDbType吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在asp.net 2中使用以下代码,将其插入数据库:

cmd.Parameters.Add("@ SCodeNo",SqlDbType.VarChar).Value = TextBox1.Text;
这是OK

现在我很困惑如何为数据类型的numeric(18,0)设置sqlDbType?
cmd.Parameters.Add("@ RegNo",SqlDbType.).Value = TextBox2.Text;
问题是没有像numeric(18,0)这样的Option.
这里RegNo =注册号,我正在使用的数据类型是数据库中的numeric(18,0).

I am Using following code in asp.net 2, To Insert into Database:

cmd.Parameters.Add("@SCodeNo", SqlDbType.VarChar).Value = TextBox1.Text;
this is O.K

Now I am confused How to set sqlDbType for the data-type numeric(18,0)?
cmd.Parameters.Add("@RegNo", SqlDbType. ).Value = TextBox2.Text;
The problem is there is no Option like numeric(18,0).
Here RegNo = Registration Number and the datatype I am using is numeric(18,0) in database.

推荐答案


尝试使用它,对我有用...

try using this, it worked for me...

cmd.Parameters.Add("@RegNo", SqlDbType.NVarChar, 18).Value = TextBox2.Text;


这篇关于为Numeric(18,0)添加参数SqlDbType吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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