所有查询均未执行 [英] All queries are not executing

查看:96
本文介绍了所有查询均未执行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个Web项目.

在我的机器上(本地)正常运行.

但是当我在服务器上上传它时发生错误,


页面上有一个按钮,上面有许多sql查询,但是在该页面停止并且数据没有插入到SQL DB中之后,仅执行一个查询.

:(

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.

:(

推荐答案

您正在使用

you are using

cmd.Dispose();



多次.删除所有这些,最后一个除外.

另外,在代码的各个部分使用try ... catch(Exception ex)来解决问题.



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.




使用尝试并捕获",然后在捕获块"中将异常记录到事件查看器中.这样捕获的异常将被记录到其上载的服务器的事件查看器中.从那里您可以轻松找出异常是什么..

谢谢,
Lijo
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




一旦处置了任何物体.它将对任何进一步的操作无效.因此,请确保您的变量在完成工作之前应处于活动状态.最佳实践是按照其他ppl的建议将变量放置在finally博客中.

或其他最佳方法是使用 SQLHelper 类来执行所有查询.

谢谢
-Amit
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


这篇关于所有查询均未执行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆