Even though the values are supplied using DropDownLists It wont Bind because System.DataRow does not contain property CountyId - I thought the only value that had to be the same was the primary key value.
CREATE TABLE [dbo].[CoItemPrice] (
[ItemId] NVARCHAR (128) NOT NULL,
[PurchasePrice] MONEY DEFAULT ((0.0000)) NOT NULL,
[SalesTaxPaid] MONEY DEFAULT ((0.0000)) NOT NULL,
[ShippingPaid] MONEY DEFAULT ((0.0000)) NOT NULL,
[HandlingFee] MONEY DEFAULT ((0.0000)) NOT NULL,
[SalesPrice] AS ((([PurchasePrice]+[SalesTaxPaid])+[ShippingPaid])+[HandlingFee]) PERSISTED NOT NULL,
PRIMARY KEY CLUSTERED ([ItemId] ASC),
CONSTRAINT [FK_CoItemPrice_CoItems_ItemId] FOREIGN KEY ([ItemId]) REFERENCES [dbo].[CoItems] ([ItemId]) ON UPDATE CASCADE
);
CREATE PROCEDURE [dbo].[CoItemsPrice_Upd] (
@ItemId NVARCHAR(128),
@PurchasePrice MONEY,
@ShippingPaid MONEY,
@CountyId INT,
@TaxTypeId INT
) AS
BEGIN
DECLARE @StatusCode INT;
BEGIN TRY
BEGIN TRANSACTION
-- +-----------------------------------------------------------
DECLARE @SalesPrice MONEY, @SalesTaxPaid MONEY, @HandlingFee MONEY, @SalesTaxRate DECIMAL(7,4)
DECLARE @ItemGroupId INT = (SELECT ItemGroupId FROM CoItems WHERE ItemId = @ItemId)
-- REMOVE AFTER INITIAL INSERT
--DELETE FROM CoItemPrice WHERE ItemId = @ItemId
SELECT @SalesTaxRate = SalesTax FROM DataLocCounty WHERE CountyId = @CountyId
-- SELECT DEFAULT TAX RATE
IF (@SalesTaxRate IS NULL)
BEGIN
SELECT @SalesTaxRate = 0.0800
END
IF (@TaxTypeId = 0)
BEGIN
SELECT @SalesTaxRate = 0.0000
END
SELECT @SalesTaxPaid = @PurchasePrice * @SalesTaxRate
-- +-----------------------------------------------------------
IF( @PurchasePrice <= 5.0000)
BEGIN
SELECT @HandlingFee = (@PurchasePrice * .10)
END
IF (@PurchasePrice BETWEEN 5.0001 AND 10.0000)
BEGIN
SELECT @HandlingFee = 1.0000
END
IF (@PurchasePrice > 10.0001)
BEGIN
SELECT @HandlingFee = 2.0000
END
IF (@ItemGroupId BETWEEN 164 AND 171) -- BLINDS
BEGIN
SELECT @HandlingFee = 5.0000
END
-- +-----------------------------------------------------------
UPDATE CoItemPrice SET PurchasePrice = @PurchasePrice, SalesTaxPaid = @SalesTaxPaid, ShippingPaid = @ShippingPaid, HandlingFee = @HandlingFee WHERE ItemId = @ItemId
-- +-----------------------------------------------------------
COMMIT TRANSACTION;
SELECT @StatusCode = 0
END TRY
-- +-----------------------------------------------------------
BEGIN CATCH
IF @@TRANCOUNT > 0
ROLLBACK TRANSACTION;
INSERT INTO [WebLogErrorsSql] (ErrorNumber,ErrorLine,ErrorMessage,ErrorSeverity,ErrorState,ProcedureName)
VALUES (ERROR_NUMBER(), ERROR_LINE(), ERROR_MESSAGE(), ERROR_SEVERITY(), ERROR_STATE(), OBJECT_NAME(@@PROCID));
SELECT @StatusCode = -1;
END CATCH
-- +-----------------------------------------------------------
RETURN @StatusCode
END
I tried to use ControlParameter but it couldnt Find the Control
Member
8 Points
100 Posts
ListView Template Parameters Different
Feb 08, 2017 03:53 AM|RobertH3|LINK
The two parameters CountyId and TaxTypeId are not stored in a table but used in a stored procedure to figure out computed columns.
Even though the values are supplied using DropDownLists It wont Bind because System.DataRow does not contain property CountyId - I thought the only value that had to be the same was the primary key value.
I even tried
But that doesnt work.
I tried to use ControlParameter but it couldnt Find the Control
Member
50 Points
55 Posts
Re: ListView Template Parameters Different
Feb 09, 2017 08:01 AM|aliceyonng@outlook.com|LINK
Hi,
which error you meet now, please be brief!