1.查询的模糊匹配 尽量避免在一个复杂查询里面使用 LIKE %parm1%—— 红色标识位置的百分号会导致相关列的索引无法使用,最好不要用。 解决办法: 其实只需要对该脚本略做改进,查询速度便会提高近百倍。改进方法如下: a、修改前台程序——把查询条件的供应商名称一栏由原来的文本输入改为下拉列表,用户模…
查看全文
private void GetImage(){ try { //验证码地址 Uri uri = new Uri("http://61.142.253.40:8085/CheckCode.aspx"); HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(uri); //设置cookie,必须有下面这句代码,…
查看全文
在某些情况下,我们经常需要使用到多线程做一些操作,比如操作文件,如果在多线程中操作同一个文件,必然会发生多个线程同时操作文件的情况,那么此时会报“文件已经被其它程序打开”之类的错误。解决方法就是使用lock关键字进行锁定。下面是实例代码: private void btnStart_Click(object sender, EventArgs e) …
查看全文
前台$.ajax({ type: "get", cache: false, url: "/xxx/xxx/", success: function (retValue) { } });当前台使用get方式请求时,后台返回JSONResult必须设置JsonReq…
查看全文
首先,form表单的提交方法要声明为post,enctype属性声明为multipart/form-data。后台方法: //验证图片格式 public bool ValidateImg(string imgName) { string[] imgType = new string[] { "gif", "jpg", "png", "bmp" }; int i = 0; …
查看全文
在MVC中配置路由如下:routes.MapRoute( name: "Article", url: "{controller}/{action}/{id}.html", defaults: new { controller = "Article", action = "Detail", id = UrlParameter.Optional } );但是运行时,发现报错,提示无法找…
查看全文
<script src="/JavaScript/ZeroClipboard.js"></script><script type="text/javascript"> $(function () { $(".article_content img").bind("click", function () { window.open(this.src); }); //实现复制功能 $("#CopyID"…
查看全文