executescalar in middle (be part) of transaction


Author
Message
Fabian R Silva, -
Fabian R Silva, -
StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)
Group: StrataFrame Users
Posts: 153, Visits: 1.2K
I need to execute a "executescalar" on a transaction to get the last invoice number again (if someone get the number that the actual invoice have... change it before save on this transaction)

I have:
...(try)...
BusinessLayer.TransactionBegin("invoiceTr", IsolationLevel.ReadCommitted);

var nextNumber = invBO.GetNextNumber(invBO.IdTalonario, DataSourceKey); // <--- THIS METHOD call a  EXECUTESCALAR VALUE.... freezes and timeout after some seconds...
invBO.Numero = invBO.HastaNumero = nextNumber;

saveUndoResult = invBO.Save(true);
...
...
...(rollback/commit)...
Edited 14 Years Ago by Fabian R Silva, -
Replies
Fabian R Silva, -
Fabian R Silva, -
StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)
Group: StrataFrame Users
Posts: 153, Visits: 1.2K
-
Edited 14 Years Ago by Fabian R Silva, -
Fabian R Silva, -
Fabian R Silva, -
StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)
Group: StrataFrame Users
Posts: 153, Visits: 1.2K
I see that I was wrong on what I tried to accomplish, I will explain better.

I need to save invoices, and was searching better way of update the invoice number (each type have his own number)



I was planning to select max actual record and put that max+1, but if I do this the problem is that there is a posible repeat of number if it is not part of transaction.

¿can be a good idea to have a table like "InvoiceNumbers" that have a column "type" and a "number"?



Then on the current transaction I can fill the table InvoiceNumbers" adding +1 to actual number by the actual invoice type (¿this lock that table?)

then I read the current table InvoiceNumbers on transaction to set that number to the Invoice.



if another transaction try to get same invoice number and type on invoicenumbers, it will wait ?

thanks and sorry my lack of understanding about transactions, first time that have multiuser app that really need to be transactional and update some tables.
Edited 14 Years Ago by Fabian R Silva, -
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View
Threaded View
Fabian R Silva, - - 14 Years Ago
Edhy Rijo - 14 Years Ago
Fabian R Silva, - - 14 Years Ago
Edhy Rijo - 14 Years Ago
                     -
Fabian R Silva, - - 14 Years Ago
                         I see that I was wrong on what I tried to accomplish, I will explain...
Fabian R Silva, - - 14 Years Ago

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search