extremely strange ado.net issue
-
G'day folks, I have been experiencing an extremely strange problem in my code, this has to be marked as a X-File episode. I have a method in my class which executes two other methods. One method(Method A) inserts a row in table A and the other (Method B) inserts a row in table B. This is part of an asp.net application. When I run the the asp.net application without debugging both methods (A and B) execute fine, however method B doesnt seem to be updating table B whereas Method A updates Table A just fine. I ran my query through MS Access with test data and the table got updated. Then I decided to step through the code and again method B seems to be updating table B. I run the application again without debugging and samething happens Table B doesnt get updated and Table A is getting updated. For the life of me I cant seem to point my finger where the problem is residing. Can this be a connectivity issue with MS Access and my asp.net application ? Both the asp.net and access database are residing in my development environment. Any pointers will be appreciated. thanks
-
G'day folks, I have been experiencing an extremely strange problem in my code, this has to be marked as a X-File episode. I have a method in my class which executes two other methods. One method(Method A) inserts a row in table A and the other (Method B) inserts a row in table B. This is part of an asp.net application. When I run the the asp.net application without debugging both methods (A and B) execute fine, however method B doesnt seem to be updating table B whereas Method A updates Table A just fine. I ran my query through MS Access with test data and the table got updated. Then I decided to step through the code and again method B seems to be updating table B. I run the application again without debugging and samething happens Table B doesnt get updated and Table A is getting updated. For the life of me I cant seem to point my finger where the problem is residing. Can this be a connectivity issue with MS Access and my asp.net application ? Both the asp.net and access database are residing in my development environment. Any pointers will be appreciated. thanks
ekynox wrote:
Any pointers will be appreciated.
Here ya go![^] Seriously, you might want to also put in some tracing code so that you can see exactly what is being sent to the database (or if the method is being called) Or perhaps there is something obvious in the method itself that is different from the other method.
Upcoming FREE developer events: * Developer! Developer! Developer! 6 * Developer Day Scotland My website
-
ekynox wrote:
Any pointers will be appreciated.
Here ya go![^] Seriously, you might want to also put in some tracing code so that you can see exactly what is being sent to the database (or if the method is being called) Or perhaps there is something obvious in the method itself that is different from the other method.
Upcoming FREE developer events: * Developer! Developer! Developer! 6 * Developer Day Scotland My website
LOL Colin that's one funny pointer. I managed to work out my problem, it was do with timing issue. By the time MethodA finishes executing, I believe access has not had time to update Table A, then MethodB starts executing and Table A is missing the relavant data and MethodB fails to insert a row in Table B. Why does it work in debug mode well when debugging there is ample time for Access to actually commit the data into the table. Solution was to a a Thread.Sleep() to cause pause and it all works. Yes you are right about placing tracing code.
public void AddStuffToDB() { MethodA(string x,string y); MethodB(string x); }