int Result,i;
Decimal d_report_other_should_pay_fee = 0;
using (SqlConnection connection = new SqlConnection(connectionString))
{
SqlCommand com = new SqlCommand("sp_maintain_multipurpose_cheque_add", connection);
com.CommandType = CommandType.StoredProcedure;
SqlParameter p1 = com.Parameters.Add("@report_date", SqlDbType.VarChar, 20);
p1.Value = ReportDate.Text;
SqlParameter p2 = com.Parameters.Add("@area", SqlDbType.VarChar, 20);
p2.Value = Session["area_code"].ToString();
SqlParameter p3 = com.Parameters.Add("@exchange_site", SqlDbType.VarChar, 30);
p3.Value = ExchangeSite.Text;
SqlParameter p4 = com.Parameters.Add("@bill_telecomm_id", SqlDbType.Decimal, 38);
p4.Value = TELECOMM_ID.Text;
SqlParameter p5 = com.Parameters.Add("@new_borrow_money_use", SqlDbType.Decimal, 30);
p5.Value = Fee.Text;
SqlParameter p6 = com.Parameters.Add("@memo", SqlDbType.VarChar, 250);
p6.Value = Memo.Text;
SqlParameter p7 = com.Parameters.Add("@enter_employee", SqlDbType.VarChar, 30);
p7.Value = Session["UserID"].ToString();
p1.Direction = ParameterDirection.Input;
p2.Direction = ParameterDirection.Input;
p3.Direction = ParameterDirection.Input;
p4.Direction = ParameterDirection.Input;
p5.Direction = ParameterDirection.Input;
p6.Direction = ParameterDirection.Input;
p7.Direction = ParameterDirection.Input; SqlParameter p8 = com.Parameters.Add("@report_other_should_pay_fee", SqlDbType.Decimal,10);
p8.Direction = ParameterDirection.Output; SqlParameter p_out = com.Parameters.Add("@RETURN_VALUE", SqlDbType.Int, 1);
p_out.Direction = ParameterDirection.ReturnValue;
connection.Open();
com.CommandTimeout = 3000;
com.ExecuteReader();
d_report_other_should_pay_fee = Convert.ToDecimal(com.Parameters["@report_other_should_pay_fee"].Value);
Result = (int)com.Parameters["@RETURN_VALUE"].Value;
}
存储过程测试,输出参数值含小数没问题
Decimal d_report_other_should_pay_fee = 0;
using (SqlConnection connection = new SqlConnection(connectionString))
{
SqlCommand com = new SqlCommand("sp_maintain_multipurpose_cheque_add", connection);
com.CommandType = CommandType.StoredProcedure;
SqlParameter p1 = com.Parameters.Add("@report_date", SqlDbType.VarChar, 20);
p1.Value = ReportDate.Text;
SqlParameter p2 = com.Parameters.Add("@area", SqlDbType.VarChar, 20);
p2.Value = Session["area_code"].ToString();
SqlParameter p3 = com.Parameters.Add("@exchange_site", SqlDbType.VarChar, 30);
p3.Value = ExchangeSite.Text;
SqlParameter p4 = com.Parameters.Add("@bill_telecomm_id", SqlDbType.Decimal, 38);
p4.Value = TELECOMM_ID.Text;
SqlParameter p5 = com.Parameters.Add("@new_borrow_money_use", SqlDbType.Decimal, 30);
p5.Value = Fee.Text;
SqlParameter p6 = com.Parameters.Add("@memo", SqlDbType.VarChar, 250);
p6.Value = Memo.Text;
SqlParameter p7 = com.Parameters.Add("@enter_employee", SqlDbType.VarChar, 30);
p7.Value = Session["UserID"].ToString();
p1.Direction = ParameterDirection.Input;
p2.Direction = ParameterDirection.Input;
p3.Direction = ParameterDirection.Input;
p4.Direction = ParameterDirection.Input;
p5.Direction = ParameterDirection.Input;
p6.Direction = ParameterDirection.Input;
p7.Direction = ParameterDirection.Input; SqlParameter p8 = com.Parameters.Add("@report_other_should_pay_fee", SqlDbType.Decimal,10);
p8.Direction = ParameterDirection.Output; SqlParameter p_out = com.Parameters.Add("@RETURN_VALUE", SqlDbType.Int, 1);
p_out.Direction = ParameterDirection.ReturnValue;
connection.Open();
com.CommandTimeout = 3000;
com.ExecuteReader();
d_report_other_should_pay_fee = Convert.ToDecimal(com.Parameters["@report_other_should_pay_fee"].Value);
Result = (int)com.Parameters["@RETURN_VALUE"].Value;
}
存储过程测试,输出参数值含小数没问题
解决方案 »
- 关于RSA加密的几点疑问!!
- 请问TcpClient如何知道服务器是否已断开连接?
- dataGridView 資料輸入的問題
- DllImport超难问题!!!
- 应用程序运行过程中异常终止,但是并没有报任何错误,万分紧急求助!!!!!
- C#制作字典
- 关于C#线程终止的问题
- 讨论:当今最红的5大软件公司是哪五大?当今最红的5大技术是哪五大?
- 请问我装上SDK后,点击“开始->程序->framework sdk v1.1”后,只有一些帮助文档,连个编辑软件都没有?这是怎么回事?
- 请问高手们哪有c#可用的mp3 ,vcd播放控件??(给分)
- 正在学习三种序列化 请各位大虾指点下
- 多个.net网站如何用一个空间搞定
@report_date varchar(20),
@area varchar(10),
@exchange_site varchar(30),
@bill_telecomm_id decimal(38),
@new_borrow_money_use decimal(10,2),
@memo varchar(250) ,
@enter_employee varchar(20),
@report_other_should_pay_fee decimal(10,2) output
as
begin
declare
@telecomm_account varchar(20),
@customer_name varchar(60),
@bank varchar(20),
@customer_account varchar(20),
@borrow_money decimal(10,2),
@borrow_money_use decimal(10,2),
@label int
select @label=0
begin tran
SELECT @telecomm_account=telecomm_account,@customer_name=customer_name,@bank=bank,@customer_account=customer_account,@borrow_money=borrow_money,@borrow_money_use=isnull(borrow_money_use,0) from bill_telecomm where id=@bill_telecomm_id
if (@borrow_money<=@borrow_money_use)
begin
print '警告:该支票费用已经使用完';
rollback tran ;
select @report_other_should_pay_fee=0
return -1;
--select @label=-1;
end
if (@new_borrow_money_use>(@borrow_money-@borrow_money_use))
begin
print '警告:支票费用使用费用大于剩余可用金额';
rollback tran
select @report_other_should_pay_fee=0
return -2;
--select @label=-2;
end
if (@borrow_money_use=0)
select @report_other_should_pay_fee=@borrow_money-@new_borrow_money_use;
else
select @report_other_should_pay_fee=@new_borrow_money_use*(-1);
print @report_other_should_pay_fee;
insert into bill_telecomm_multipurpose_cheque(report_date,area,exchange_site,bill_telecomm_id, telecomm_account,customer_name,bank,customer_account,borrow_money,borrow_money_use,report_other_should_pay_fee,memo,enter_datetime,enter_employee )
values(@report_date,@area,@exchange_site,@bill_telecomm_id,@telecomm_account,@customer_name,@bank,@customer_account,@borrow_money,@new_borrow_money_use,@report_other_should_pay_fee,@memo,GETDATE(),@enter_employee )
update bill_telecomm set borrow_money_use=@borrow_money_use+@new_borrow_money_use where id=@bill_telecomm_id
commit tran ;
--return @label ;
return 0 ;
end
p8.Scale = (byte)2;
请教了一位高手,加上这两句,就好了
SqlParameter.Scale
没用过,我一般是传入或者是传出来之后在限制精度的。