• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 325
  • Last Modified:

i get error when i make a transaction with 100% discount

when i try to save data to a mssql server database, i get an error message saying multiple-step operation generated errors. check each status value. this error pops only when i give 100% discount to a sales transaction. if i give 99% discount this error does not appear. i have attached a code file. in the code where dm.so_trans.post this code generates the error

please let me know how to fix it, cox i need to give 100% discount for some sales
somebug.txt
0
thooloon
Asked:
thooloon
  • 6
  • 6
  • 5
1 Solution
 
Ferruccio AccalaiSenior developer, analyst and customer assistance Commented:
Are you sure that the error comes from the transactions?
If it appear when calling dm.so_trans.post maybe there's something related to it, as I can't see nothing about this dm.so_trans other then that call.

What says the error?
0
 
thooloonAuthor Commented:
dear
below is the error

"multiple-step operation generated errors. check each status value"

regards
0
 
Geert GruwezOracle dbaCommented:
this error comes from the database
i have never seen this error in delphi

check your stored procedures and triggers on the database
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Ferruccio AccalaiSenior developer, analyst and customer assistance Commented:
That's right, check in your table.post if there's any wrong value type, like string in real field or something else
0
 
thooloonAuthor Commented:
dear guys,

the thing is that i can give discount from 1% to 99%, but when i give 100% then i get the error message

anyhow i will keep checking...

regards
0
 
Ferruccio AccalaiSenior developer, analyst and customer assistance Commented:
Have you checked the value stored in the table debugging this part?
if dPcnt = 100 then
            begin
               dm.so_transdiscount_amount.Value := total_sales;
               dm.so_transdiscount_percent.Value:=100;
            end
         else
            begin
                dm.so_transdiscount_amount.Value:=dAmount;
                dm.so_transdiscount_percent.Value:=dPcnt;
            end;

0
 
Geert GruwezOracle dbaCommented:
i have the impression that you have some triggers which fire one after the other
and one is producing a error on your database
0
 
Ferruccio AccalaiSenior developer, analyst and customer assistance Commented:
Another check, as your code seems to be right.
Is there any code in the beforepost or afterpost event that can raise the error?
As this error is raised during the table.post ther could be any other related table that return the error, or just a wrong value in some field in the posted table.
Hard to find the problem just looking at your code...
0
 
thooloonAuthor Commented:
there is no triggers attached to it, neither any code on before or after post

i have debug the code

if dPcnt = 100 then
            begin
               dm.so_transdiscount_amount.Value := total_sales;
               dm.so_transdiscount_percent.Value:=100;
            end
         else
            begin
                dm.so_transdiscount_amount.Value:=dAmount;
                dm.so_transdiscount_percent.Value:=dPcnt;
            end;


there is nothing unusual

0
 
Geert GruwezOracle dbaCommented:
did you just change the text attachment ?
0
 
Geert GruwezOracle dbaCommented:
it's difficult to follow your code with that indentation
don't you use the standard 2 spaces ?
0
 
Geert GruwezOracle dbaCommented:
you don't catch any error
you start a transaction, but there is no condition for catching errors

normally:

start tran
try
  // do sql

  commit
exception
  rollback
end;
0
 
Ferruccio AccalaiSenior developer, analyst and customer assistance Commented:
Geert, i've checked the code (the part related to the calculation using standard values) and it's ok.

Another thing, just a try.
Could be something related to fieldtypes?
For example char and varchar are different, as char type use fixed lenght and varchar not, so trying to store any value in a char field could return error if it's shorter than the fixed lenght (i.e. '700,00' with fieldsize 7 become '700,00 ')
0
 
thooloonAuthor Commented:
i did not change the text attached,

let me check and come back to your guys again
0
 
thooloonAuthor Commented:
problem solved,
the problem was my fild was too small to give an additional digit it was decimal(6,4) so i have changed the field to decimal(7,4) now its working. the database was giving this error message
thanks all
0
 
thooloonAuthor Commented:
thanks for the lovely comments
0
 
Geert GruwezOracle dbaCommented:
it's allways a good thing to post all the errors you get
they are allways good clues to what is wrong
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 6
  • 6
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now