本文介绍了在插入值时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
插入页面上出现错误.我附上我的代码页面aspx.cs和业务逻辑页面以及错误.请帮帮我.提前感谢
插入时的Aspx.cs页面
Hi,
Getting error on insert page. i am enclosing my code of both pages aspx.cs and bussiness logic page and error. please help me out. Thanx in advance
Aspx.cs page on insert
protected void btnAdd_Click(object sender, EventArgs e)
{
if (objSaleSanctionDetails.Insert(Convert.ToInt64(Session["SaleSanctionID"].ToString()), txtlotno.Text, txtsaleprice.Text, txtemd.Text, txtremsp.Text, txtvat.Text, txtfcess.Text,txttotal.Text))
{
lblStatus.Text = Resources.Language.Common_Record_Add;
}
BindGrid(Session["Language"].ToString());
}
业务逻辑页面
clsSaleSanctionDetails.cs
Bussiness logic page
clsSaleSanctionDetails.cs
public class clsSaleSanctionDetails
{
public clsSaleSanctionDetails()
{
}
public bool Insert(long SaleSanctionID, string LotNo, Double SalePrice, Double EMD_Amount, Double RemainingSalePrice, Double VAT, Double ForestDepartmentCess, Double Total)
{
bool res = false;
System.Collections.ArrayList sel = new System.Collections.ArrayList();
sel.Add("SP_tr_Sale_SanctionDetails_Insert");
ArrayList lstParam = new System.Collections.ArrayList();
SqlParameter param;
param = new SqlParameter();
param.ParameterName = "@SaleSanctionID";
param.SqlDbType = SqlDbType.BigInt;
param.Value = SaleSanctionID;
lstParam.Add(param);
param = new SqlParameter();
param.ParameterName = "@LotNo";
param.SqlDbType = SqlDbType.VarChar;
param.Value = LotNo;
lstParam.Add(param);
param = new SqlParameter();
param.ParameterName = "@SalePrice";
param.SqlDbType = SqlDbType.Float;
param.Value = SalePrice;
lstParam.Add(param);
param = new SqlParameter();
param.ParameterName = "@EMD_Amount";
param.SqlDbType = SqlDbType.Float;
param.Value = EMD_Amount;
lstParam.Add(param);
param = new SqlParameter();
param.ParameterName = "@RemainingSalePrice";
param.SqlDbType = SqlDbType.Float;
param.Value = RemainingSalePrice;
lstParam.Add(param);
param = new SqlParameter();
param.ParameterName = "@VAT";
param.SqlDbType = SqlDbType.Float;
param.Value = VAT;
lstParam.Add(param);
param = new SqlParameter();
param.ParameterName = "@ForestDepartmentCess";
param.SqlDbType = SqlDbType.Float;
param.Value = ForestDepartmentCess;
lstParam.Add(param);
param = new SqlParameter();
param.ParameterName = "@Total";
param.SqlDbType = SqlDbType.Float;
param.Value = Total;
lstParam.Add(param);
res = new eAuctionDAL.SQLDAL().UpdateTransData(sel, lstParam, false);
return res;
}
错误7参数"4":无法从字符串"转换为双精度"
D:\ testing data \ EAuction \ SaleSanctionDetails.aspx.cs 117 132 D:\ testing data \ EAuction \
Error7Argument ''4'': cannot convert from ''string'' to ''double''
D:\testing data\EAuction\SaleSanctionDetails.aspx.cs117132D:\testing data\EAuction\
推荐答案
In that Argument try something like this
param.ParameterName =Convert.ToDouble("");
这篇关于在插入值时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!