SqlDbType.Decimal 问题 现表中有一字段Price,字段类型decimal,长度是默认的9 精度18,小数4,sql语句参数化的时候应该怎么写cmd.Parameters.Add(new SqlParameter("@Price", SqlDbType.Decimal, 9)); 这样写是不是无法达到预期效果 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 public SqlParameter(string parameterName, SqlDbType dbType, int size, ParameterDirection direction, bool isNullable, byte precision, byte scale, string sourceColumn, DataRowVersion sourceVersion, object value);这个重载可以控制精度 byte precision, byte scale 这两个是不是控制精度的 cmd.Parameters["@Price"].Precision = (byte)18; cmd.Parameters["@Price"].Scale = (byte)4; 按道理是可以达到结果的,数据库 C#程序 int int32text stringbigint int64binary System.Byte[]bit Booleanchar stringdatetime System.DateTimedecimal System.Decimalfloat System.Doubleimage System.Byte[]money System.Decimalnchar Stringntext Stringnumeric System.Decimalnvarchar Stringreal System.Singlesmalldatetime System.DateTimesmallint Int16smallmoney System.Decimaltimestamp System.DateTimetinyint System.Byteuniqueidentifier System.Guidvarbinary System.Byte[]varchar StringVariant Object这也是在博客园上面看到的,博客园上面的文章很好 在JSON中二维数组怎么处理 新手请教高手!! 动态加载FLASH效果在IE下失效 jQuery 分页问题? “/membership”应用程序中的服务器错误。 popMail.SmtpServer = "smtp.163.com";为什么在编译出错,内有相关的代码 关于部署和实现的问题,谢谢 Infragistics控件的问题,哪位好心人帮帮忙呀!!! 菜鸟提问--如何在两个aspx页面中传递参数 在XSL脚本中,为了测试方便我加了一条XML.SAVE "C:\BOOK1.XML"?? 如何使用使用ASP.NET中使用APPLICATION global.asax什么时候能用到?有什么用?
public SqlParameter(string parameterName, SqlDbType dbType, int size, ParameterDirection direction, bool isNullable, byte precision, byte scale, string sourceColumn, DataRowVersion sourceVersion, object value);这个重载可以控制精度
cmd.Parameters["@Price"].Scale = (byte)4;
数据库 C#程序
int int32
text string
bigint int64
binary System.Byte[]
bit Boolean
char string
datetime System.DateTime
decimal System.Decimal
float System.Double
image System.Byte[]
money System.Decimal
nchar String
ntext String
numeric System.Decimal
nvarchar String
real System.Single
smalldatetime System.DateTime
smallint Int16
smallmoney System.Decimal
timestamp System.DateTime
tinyint System.Byte
uniqueidentifier System.Guid
varbinary System.Byte[]
varchar String
Variant Object这也是在博客园上面看到的,博客园上面的文章很好