0
我正在努力解決一個錯誤。我檢查過我的存儲過程和代碼,但我不知道問題實際存在的地方。 錯誤將DataType nvarchar轉換爲十進制
MY SP:
ALTER PROCEDURE [dbo].[sp_Tbl_Contract_Insert]
-- Add the parameters for the stored procedure here
@ItemID int,
@BrandID int,
@CountID int,
@SellerID int,
@BuyerID int,
@CountryFromID int,
@countryToID int,
@UnitID int,
@KeyWinCountNumber varchar(50),
@ContractNumber varchar(50),
@ContractDate varchar(50),
@TotalQty varchar(50),
@Vans varchar(50),
@UnitPrice decimal(18,2),
@TotalAmount decimal(18,2)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
-- Insert statements for procedure here
Insert into Tbl_Contract (ItemID,BrandID,CountID,SellerID,BuyerID,
CountryFromID,CountryToID,UnitID,
KeyWinCountNumber,ContractNumber,ContractDate,TQty,Vans,
UnitPrice,TAmount) values (@ItemID,@BrandID,@CountID,@SellerID,@BuyerID,@CountryFromID,
@countryToID,@UnitID,@KeyWinCountNumber,@ContractNumber,@ContractDate,@TotalQty,
@Vans,@UnitPrice,@TotalAmount)
END
CODE:
if (ViewState["action"].ToString() == "Insert")
{
try
{
obj = new DalLib();
paramArray = new string[16, 2];
paramArray[0, 0] = "@ItemID";
paramArray[0, 1] = ddlItem.SelectedValue.ToString();
paramArray[1, 0] = "@BrandID";
paramArray[1, 1] = ddlBrand.SelectedValue.ToString();
paramArray[2, 0] = "@CountID";
paramArray[2, 1] = ddlCount.SelectedValue.ToString();
paramArray[3, 0] = "@SellerID";
paramArray[3, 1] = ddlSellerName.SelectedValue.ToString();
paramArray[4, 0] = "@BuyerID";
paramArray[4, 1] = ddlBuyerName.SelectedValue.ToString();
paramArray[5, 0] = "@CountryFromID";
paramArray[5, 1] = ddlCountryFrom.SelectedValue.ToString();
paramArray[6, 0] = "@countryToID";
paramArray[6, 1] = ddlCountryTo.SelectedValue.ToString();
paramArray[7, 0] = "@UnitID";
paramArray[7, 1] = ddlUnit.SelectedValue.ToString();
paramArray[8, 0] = "@KeyWinCountNumber";
paramArray[8, 1] = txtkeyWinCount.Text;
paramArray[9, 0] = "@ContractNumber";
paramArray[9, 1] = txtContractNum.Text;
paramArray[10, 0] = "@ContractDate";
paramArray[10, 1] = txtContractDate.Text;
paramArray[11, 0] = "@TotalQty";
paramArray[11, 1] = txttotalqty.Text;
paramArray[12, 0] = "@Vans";
paramArray[12, 1] = txtVans.Text;
paramArray[13, 0] = "@UnitPrice";
paramArray[13, 1] = txtUnitPrice.Text;
paramArray[14, 0] = "@TotalAmount";
paramArray[14, 1] = txtTotal.Text;
paramArray[15, 0] = "`";
result = obj.setData("sp_Tbl_Contract_Insert", paramArray);
mtvResult.ActiveViewIndex = 0;
LoadData();
EmptyFields();
}
catch
{
}
}
我DB_Columns:
空捕獲不會幫助... –
你有十進制參數,並傳遞字符串... –
我也嘗試解析字符串,:/但沒有幫助 –