Failed to save


Author
Message
ChanKK
ChanKK
StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)
Group: Forum Members
Posts: 190, Visits: 1.3K
Hi,

I created this post to continue the problem I post at Memory leak thread. I am not sure should I add mine to the post "Transaction Fail".



Anyway, I have created a simple project which reproduce the error I mentioned if save more than one BO within "same" transaction.



Beside, I also attached screenshot to show the actual error happen before I call Rollback; Also, the screenshot that show "SqlTransaction has completed" error.



As I found that, DataSource.Transactions[0].Connection become null just after the code below when first BO.Save() is called.



'-- UpdateDataTableThread()

lnRowsAffected = Me._DataSource.UpdateRow(loUpdateInfo, loRow, New ConcurrencyExceptionHandler(AddressOf HandleConcurrencyException), New AddRowErrorHandler(AddressOf AddRowError))



Please advice.



Thank you
Attachments
ActualError.JPG (116 views, 56.00 KB)
ChanKK
ChanKK
StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)
Group: Forum Members
Posts: 190, Visits: 1.3K
Hi,

I just come across this forum post, and it mentioned it is SqlTransaction.Connection property goes null randomly is actually ADO.NET bug. It provides workaround as well.



I am not sure if this bug is still exist in ADO.NET as this post is dated year 2007.



http://www.ormapper.net/Forums/Default.aspx?part=74&action=thread&id=2450&key=IaC12zYu0ykFv3qP9v11Tg%3D%3D
ChanKK
ChanKK
StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)
Group: Forum Members
Posts: 190, Visits: 1.3K
Hi,

I do further testing and found that, the transaction.connection goes null just after loReader.Close() is executed. I checked the code and found that SF use do the following in InternalExecuteReader(). Do you think it is the cause?



'-- Execute the command

Return Command.ExecuteReader(CommandBehavior.CloseConnection)




I attached screenshot to show Watch window shown Transaction.Connection has something, but goes null after Reader.Close().



Hope my information helps and not confuse you.



Thank you
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
We set the connection object only on certain areas.  This is not one of them.  For example, when you call the FillDataTable method on a BO and pass a DbCommand object, we will set the Connection automatically.  However, this is the only type of scenario that we do this withing the framework.

Where is this code that you are showing screen shots of?

ChanKK
ChanKK
StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)
Group: Forum Members
Posts: 190, Visits: 1.3K
Hi,

It is at SqlDataSourceItem.UpdateRow().
Edhy Rijo
E
StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)StrataFrame VIP (4.7K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
ChanKK (05/06/2009)
Hi,

It is at SqlDataSourceItem.UpdateRow().


ChanKK,

I believe Trent is asking in which class/method/BO is the transactional code?


Edhy Rijo

ChanKK
ChanKK
StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)
Group: Forum Members
Posts: 190, Visits: 1.3K
Edhy Rijo (05/06/2009)
ChanKK (05/06/2009)
Hi,

It is at SqlDataSourceItem.UpdateRow().


ChanKK,

I believe Trent is asking in which class/method/BO is the transactional code?





Hi,

Sorry, I didn't get you.



I have attached the sample project, this behavour can be "seen" when first BO.Save() is called.
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Chan,

I will post on the other thread also, but we found where we had made a change to improve transaction performance.  If you were NOT using SPROCS for your inserts and updates on a transaction, the error you are referring to would occur.  By default we do everything with SPROCS, but the ExecuteReader was being closed.  The build that has just been posted will fix the SqlTransaction issue you have been running into.

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search