zoukankan      html  css  js  c++  java
  • 每天都有新发现 2009年10月21日 Decimal 和存储过程OUTPUT

    decimal(C# 参考)

    decimal 关键字表示 128 位数据类型。同浮点型相比,decimal 类型具有更高的精度和更小的范围,这使它适合于财务和货币计算。decimal 类型的大致范围和精度如下表所示。

    大致范围:±1.0 × 10-28 到 ±7.9 × 1028

    精度:28 到 29 位有效位

    .NET Framework 类型:System.Decimal

    如果希望实数被视为 decimal 类型,请使用后缀 m 或 M

     

    存储过程中返回值 OutPut的使用举例!

    在c#代码中的调用。

            public string GetInpourTrackCumulativeResult()
            {
                using (SqlConnection connection = GetSqlConnection())
                {
                    SqlCommand command = new SqlCommand("InpourTrack_GetCumulativeResult", connection);
                    command.CommandType = CommandType.StoredProcedure;
                    command.Parameters.Add("@ReturnCumulativeResult",SqlDbType.Decimal).Direction =ParameterDirection.Output;
                    
                    connection.Open();
                    command.ExecuteNonQuery();
    
    
                    string CumulativeResult = command.Parameters["@ReturnCumulativeResult"].Value.ToString();
                    connection.Close();
                    return CumulativeResult;
                }
            }

    数据库中存储过程:

    CREATE PROCEDURE [dbo].[InpourTrack_GetCumulativeResult]
    	@ReturnCumulativeResult Decimal OUTPUT
    AS
    BEGIN
    	
    	SET NOCOUNT ON;
    
        set @ReturnCumulativeResult=( SELECT SUM(AccountNO) FROM InpourTrack)
    
    END
     
  • 相关阅读:
    bootstrap
    移动视口,以及适配
    CSS线性渐变
    css之什么是bfc
    css 深入进阶之定位和浮动三栏布局
    webpack 4 技术点记录
    jQuery的学习总结
    jQuery 知识大全
    JS高级进阶
    正则
  • 原文地址:https://www.cnblogs.com/dupeng0811/p/1587937.html
Copyright © 2011-2022 走看看