SP_A
is a stored procedure that calls SP_B
, then does a SELECT, and then UPDATES the same records/column that SP_B
just UPDATED. SP_A
has a TRANSAC开发者_C百科TION around the SELECT and UPDATE statements followed by a COMMIT.
Now, everything works perfectly when I call SP_A
from a MySQL command prompt. However, when I call it from C#, it times out every single time.
The strange thing is, if I change SP_A
so that it doesn't call SP_B
and from the C# code call SP_B
and then SP_A
separately, it works. Why is this?
I'm still trying to pin down exactly what the issue is. It could be:
- You can't call a SP that calls another SP
- You can't call a SP that calls another SP that UPDATES the same records as the callee UPDATES
- You can't do that above when there's a transaction involved
And remember, the problem ONLY appears when running it from C# using MySqlCommand
Note:
MySql.Data v2.0.50727 MySQL Connector Net 6.2.2 ADO.Net driver for MySQL .NET Framework 4It sounds like the CommandTimeout is the issue -> whenver a 'long' query occurs the .NET Connector will timeout. Increasing the CommandTimeout threshold should allow the query/procedure to work.
Note: The timeout is in seconds.
精彩评论