随笔分类 -  asp.net

摘要:mysql -h localhost -u root -p 123456 < F:/hello world/niuzi.sql 阅读全文
posted @ 2013-08-14 17:07 ajunfly 阅读(389) 评论(0) 推荐(0)
摘要:declare @path varchar(800) declare @name varchar(100) set @name = 'DatabaseName'; set @path = 'D:\DataBaseBack\' + @name + '_' + convert(varchar(50),getdate(),112)+'.bak' backup database @name to disk = @path with noinit,nounload,noskip,stats=10,noformat 阅读全文
posted @ 2013-05-17 14:08 ajunfly 阅读(128) 评论(0) 推荐(0)
摘要:<%@ WebHandler Language="C#" class="mergeHandler" %>using System; using System.Web; using System.IO; using System.Text;public class mergeHandler : IHttpHandler { private const string CacheKeyFormt = "CacheKey_{0}_{1}_"; public void ProcessRequest(HttpContext conte 阅读全文
posted @ 2013-05-06 13:59 ajunfly 阅读(337) 评论(0) 推荐(0)
摘要:public void SetValue() { SqlConnection connection = new SqlConnection("ConnectionString"); connection.Open(); SqlTransaction tran = new SqlTransaction(); SqlCommand command = new SqlCommand(); command.Connection = connection; command.Transaction = tran; try { command.CommandText = "in 阅读全文
posted @ 2013-03-20 17:10 ajunfly 阅读(140) 评论(0) 推荐(0)
摘要:判断缓存是否存在 if (HttpRuntime.Cache[key] == null) { }插入缓存 缓存过期时间为2个小时NoAbsoluteExpiration:相对过期时间,生成缓存后若在没有过期的时间段被取,则过期时间后推10分钟,例如:11:1分钟时生成的 在11:5分钟时被取了,则过期时间为11:15分钟HttpRuntime.Cache.Insert(key.ToUpper(), dic, null,System.Web.Caching.Cache.NoAbsoluteExpiration,TimeSpan.FromMinutes(10));NoSlidingExpirat. 阅读全文
posted @ 2013-02-19 18:34 ajunfly 阅读(219) 评论(0) 推荐(0)
摘要:static string str = "|add|and|exec|insert|select|delete|update|chr|mid|master|or|truncate|char|declare|join|"; public static bool DataVerify() { string type = HttpContext.Current.Request.RequestType.ToLower(); bool flag = true; if (type == "post") { for (int i = 0; i < HttpCon 阅读全文
posted @ 2013-02-16 17:58 ajunfly 阅读(341) 评论(0) 推荐(0)
摘要:主要用到的是WebRequest和WebResponseprotected void ToHtml() { WebRequest request = WebRequest.Create("http://www.hao123.com"); WebResponse response = request.GetResponse(); StreamReader reader = new StreamReader(response.GetResponseStream(), System.Text.Encoding.UTF8); string content = reader.Read 阅读全文
posted @ 2012-12-14 15:55 ajunfly 阅读(2184) 评论(0) 推荐(0)
摘要:添加用户控件 包含两个按钮 add和del OnClick方法为 addClick delClick定义委托public delegate void BtnDelegateHandler(object sender, EventArgs e);定义事件public event BtnDelegateHandler btnAdd;public event BtnDelegateHandler btnDel; protected void addClick(object sender, EventArgs e) { if (this.btnAdd != null) this.btnAdd(send 阅读全文
posted @ 2012-12-13 11:43 ajunfly 阅读(241) 评论(0) 推荐(0)
摘要:UpdatePanel是没有回发事件的所有,无法重新加载javascript和css处理方法 <script type="text/javascript" language="javascript"> Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(BeginRequestHandler); Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler); functio 阅读全文
posted @ 2012-10-23 14:44 ajunfly 阅读(1383) 评论(0) 推荐(0)
摘要:C#的委托是每个程序员需要掌握的知识,它更好的处理了面向对象的开发。但是很多时候学习起来不是那么易入门,所以有必要和大家分享一下委托的知识 委托就就好比一个代理公司,它只做中间处理,个人和企业不需要知道他是怎么处理的。1:定义 2:声明 3:实例化 4:作为参数传递 5:使用委托 这个概念比较抽象,我们还是直接看实例吧 要做一个计算器 1包括四种算法 加减乘除 protected void JiaF(int a, int b) { Response.Write("+:" + (a + b).ToString() + "<br>"); } pr 阅读全文
posted @ 2012-10-22 14:50 ajunfly 阅读(184) 评论(0) 推荐(0)
摘要:表单提交分两种方式 post和get post在传值的时候地址栏中看不到传值内容,建议在做数据添加、修改或删除的时候,也就是直接更改数据库表中的内容时用post传值 get在传值的时候地址栏中能看到传值内容,安全性较低,所以在数据查询的时候用get传值 前台html控件的name和id属性必须存在 1: post 后台页面用Request.Form["控件id"]获得控件内容 2:get后台页面用Request.QueryString["控件id"]获得控件内容 阅读全文
posted @ 2012-08-27 18:57 ajunfly 阅读(288) 评论(0) 推荐(0)
摘要:本文转载发明的博客园 usingSystem;usingSystem.Collections;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Web;usingSystem.Web.SessionState;usingSystem.Web.UI;usingSystem.Web.UI.WebControls;usingSystem.Web.UI.HtmlControls;usingSystem.Xml;privateXmlDocumentxmlDoc;//loadxmlfileprivatev 阅读全文
posted @ 2012-08-26 17:10 ajunfly 阅读(164) 评论(0) 推荐(0)
摘要:主要用到递归循环获取子结点 /// <summary> /// 生成根节点 /// </summary> /// <param name="treeview"></param> protected void BindTreeView(long ID, TreeView treeview) { DataTable dt = menuLogic.GetMenu2(ID, User.Identity.Name); treeview.Nodes.Clear(); DataRow[] parentrow = dt.Select(&quo 阅读全文
posted @ 2012-08-26 17:08 ajunfly 阅读(4187) 评论(0) 推荐(0)
摘要:using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.IO;using System.Text;/// <summary>///DownLoad 的摘要说明/// </summary>public class FileHelper{ public FileHelper() { // //TODO: 在此处添加构造函数逻辑 // } /// <summary> /// 文件上传到的路径 /// </summary> 阅读全文
posted @ 2012-05-29 13:42 ajunfly 阅读(238) 评论(0) 推荐(0)
摘要:ajax代码$.ajax({ type: "post", url: "AjaxHandler.ashx", data: {"value1":'万事如意',"value2":'心想事成',"value3":'牛牛牛'},//参数要对应 success: function(result) { alert(result); } });一般处理程序操作ashx获取参数值 string value1 = context.Request.Form[" 阅读全文
posted @ 2012-05-13 16:08 ajunfly 阅读(11437) 评论(1) 推荐(2)
摘要:oninput="getInputValue(this)" onpropertychange="getInputValue(this)",oninput支持火狐onpropertychange支持IE 阅读全文
posted @ 2012-02-24 14:54 ajunfly 阅读(320) 评论(0) 推荐(0)
摘要:#region MD5算法public string md5(string str, int code){if (code == 32) //32位加密{return System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(str, “MD5″).ToLower();}else //16位MD5加密(取32位加密的9~25字符){return System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(str, 阅读全文
posted @ 2012-01-10 21:06 ajunfly 阅读(1963) 评论(0) 推荐(0)
摘要:/// <summary> /// 赋值 表名,控件名,要查询的唯一数据 /// </summary> protected void SetEvaluate(string TableName, string UpName, string Id) { ContentPlaceHolder cph = (ContentPlaceHolder)Page.Master.FindControl("cph_context"); UpdatePanel up = (UpdatePanel)cph.FindControl(UpName); DataTable dt 阅读全文
posted @ 2012-01-09 19:14 ajunfly 阅读(275) 评论(0) 推荐(0)
摘要:<script language="javascript" type="text/javascript"> function UserPrint() { bdhtml=window.document.body.innerHtml; var headstr = "<html><head></head><body>"; var footstr = "</body>"; var bodystr = document.all.item("pr 阅读全文
posted @ 2012-01-08 19:37 ajunfly 阅读(12136) 评论(1) 推荐(0)