Click here to Skip to main content
15,885,216 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I have created a web project.

which is working properly in my machine(Locally).

but When i Upload it on server error occur,


Page has a button and many sql queries on it but only one query is executing after that page stop and data is not being insert in SQL DB.

:(
Posted
Updated 4-Jun-12 5:51am
v2

you are using

C#
cmd.Dispose();


multiple times. Remove all these except for the last one.

Also, use try ... catch(Exception ex) around sections of your code as an aid to trouble shooting.
 
Share this answer
 
Hi,

Use Try and Catch and in the Catch Block log the exception to Event Viewer. So that the exception caught will be logged into the event viewer of the Server where its uploaded. From there you can easily figure out what the exception is..

Thanks,
Lijo
 
Share this answer
 
Hi,

Once you dispose any object. it will be invalidated for any further operation. so make sure your variable should be live until it's work done. and best practice is to dispose your variables in finally blog as other ppl suggested.

Or other best way is to use SQLHelper class to execute your all queries.


Thanks
-Amit
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900