By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,042 Members | 1,017 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,042 IT Pros & Developers. It's quick & easy.

Doubling the order in my table

P: n/a
When user clicks SAVE button, it creates a new order with some products.

I open connection, set isolation level on adXactIsolated(1048576) - because
I have trigger on tables,
and then begin transaction. (For all other isolation levels trigger is not
rolled back!)

I then execute couple sql stored procedures, which inserts couple tables and
at the end if everything is fine, I commit transaction otherwise I rollback
transaction.

Everthing is fine, but sometimes happends that I get 2 or 3 orders, exactly
the same. It looks like that the system copy couple times the same order in
the table. I don't know why?

At the begin of the page I have:

Response.Expires = -1
Response.Expiresabsolute = Now() - 1
Response.AddHeader "pragma","no-cache"
Response.AddHeader "cache-control","private"
Response.CacheControl = "no-cache"

so refresh of the page is not possible - anyway, that is not happening so
there is 100% no source of the problem.

And my code looks like:

set Cn=Server.CreateObject("ADODB.Connection")
Cn.Open connectionString
cn.IsolationLevel=1048576
cn.BeginTrans

sql="exec e_skladisceizdelek '"&idIzd&"',"&kolicinaNova&","&idSklCilj
cn.execute(sql)

sql="exec e_skladisceizdelek '"&idIzd&"',-"&kolicinaNova&","&idSkl
cn.execute(sql)

sql="SET NOCOUNT ON; DECLARE @idPrenosa int;exec e_prenosSkladiscIzd
'"&idIzd&"',"&kolicinaNova&","&idSkl&","&idSklCilj &","&session("uporabnik")(
0,0)&","&komentar&",@idPrenosa OUTPUT; SELECT @idPrenosa"

idPrenosa=cn.EXECUTE(SQL).Fields.item(0).Value

IF ERR.number=0 then
cn.CommitTrans
else
cn.RollbackTrans
Response.Write err.Description&err.Source&"
end if
cn.Close
set cn=nothing

Does anybody know the solution?

Thank you,
Simon
Jul 19 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.