Using Visual Studio Tools to Round Prices

Hi:

Below is a previously entered case.  I'm finding that I need to accomplish this "ROUND" statement using Visual Studio Tools, according to one person I spoke with.

I've never used Visual Studio Tools.  So, how would I use them to update a database to conduct this "ROUND" programming?

Thanks!

TBSupport




Hello:

Actually, I need that second argument because I want the truncation.  :)

In any case, I revised my trigger and got better results--sort of.  When I tab past the line containing my item, nothing happens.  But, when I click back on that line, the "correct change" happens perfectly.  There is a problem with this, though.

I obviously don't like that I have to click back on my original line for this change to happen.

Anyway, below are my revised triggers--one for the insert and one for the update.  They're both working.  But, again, I don't like having to click back on the grid.

So, these only work if I in essence "refresh" the grid line (i.e. click "Print", hit "Save", or click back on the line item).

If you can let me know what I'm doing wrong, that would be awesome!

ALTER TRIGGER dbo.[ROUNDUNITPRICE]
ON dbo.[SOP10200]
AFTER INSERT
AS
UPDATE SOP10200 SET SOP10200.UNITPRCE =
ROUND(SOP10200.UNITPRCE, 2, 1)

ALTER TRIGGER dbo.[ROUNDUNITPRICE2]
ON dbo.[SOP10200]
FOR UPDATE
AS
IF UPDATE(UNITPRCE)
BEGIN
UPDATE SOP10200 SET SOP10200.UNITPRCE =
ROUND(SOP10200.UNITPRCE, 2, 1)
END

Thanks!

TBSupport
LVL 1
TBSupportAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Brendt HessSenior DBACommented:
The basic call here is that the action only happens in the DB if the line performs an action sending the data to the DB.  What it looks as if you will need to do is to add code to handle the windows event triggered when a given row loses focus - or gains focus, depending on what you have available and when you want the data to be submitted.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
TBSupportAuthor Commented:
I need to know how to conduct this activity with Visual Studio Tools, based on the recommendation of a very experienced colleague of mine.

Can this not be done through the Visual Studio Tools?

TBSupport
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2008

From novice to tech pro — start learning today.