如何读取数值型变量 [英] how to read numeric type variable

查看:76
本文介绍了如何读取数值型变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好!

我在SQL Server中定义了一个变量数字"类型

现在,当我想以c像
一样阅读它时
以这种方式读取"int"
(stingbuilder sb.Append((((int)rdr ["mrfno_nu"]).ToString());

和字符串"以这种方式
(stingbuilder sb.Append((((string)rdr ["mrfno_nu"]).ToString());


那么如何读取数字类型

hi to all!

i define a variable "numeric" type in sql server

now when i want to read it in c sharp like

to read "int" in this way
(stingbuilder sb.Append(((int)rdr["mrfno_nu"]).ToString());

and "string" in this way
(stingbuilder sb.Append(((string)rdr["mrfno_nu"]).ToString());


so how to read numeric type

推荐答案

看看这张桌子

http://msdn.microsoft.com/en-us/library/cc716729.aspx [ ^ ]


干杯!
Take a look on this table

http://msdn.microsoft.com/en-us/library/cc716729.aspx[^]


Cheers!


使用decimal:
(decimal) rdr["mrfno_nu"]


using System.Text;
//firs import the above namespace
        
        
        StringBuilder sb=new StringBuilder();

//to read "int" in this way 
         sb.Append(Convert.ToInt32(rdr["mrfno_nu"].ToString()));

//and "string" in this way
         sb.Append(Convert.ToString(rdr["mrfno_nu"].ToString()));


Hope it will help you.


这篇关于如何读取数值型变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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