
Asp.net
zmm0727
这个作者很懒,什么都没留下…
展开
-
单附件上传
事件代码如下: protected void btnUp_Click(object sender, EventArgs e) { if (flu.PostedFile != null && flu.PostedFile.ContentLength > 0) { string ext = S原创 2012-11-14 15:01:39 · 271 阅读 · 0 评论 -
将控制台程序改成windows服务
1、在解决方案里添加windows服务,之后在Service1.cs[设计]页右键添加安装程序,在Service1.cs[代码]页的OnStart函数里编写程序启动时的代码2、在ProjectInstaller.cs设置服务启动的部分属性,如: this.serviceInstaller1.ServiceName = "SuidaoWindowsService";//原创 2013-04-27 16:45:30 · 4536 阅读 · 0 评论 -
获取客户端的IP地址
public static string GetIPAddress() { string user_IP = string.Empty; if (System.Web.HttpContext.Current.Request.ServerVariables["HTTP_VIA"] != null) {原创 2013-03-15 16:23:57 · 451 阅读 · 0 评论 -
输出信息到日志(更新版)
private static string dirPath = System.Configuration.ConfigurationManager.AppSettings["filepath"]; //加锁 static object thisLock = new object(); public static void WritelogLoc原创 2013-03-01 10:52:21 · 229 阅读 · 0 评论 -
将DataTable中的数据以Xml格式写到指定的文件内,并读取
1、写入 public void EventCodeSigns() { //创建DataTable数据表格,并填充数据。 DataTable dt = new DataTable(); dt.TableName = "huanjing"; dt.Columns.A原创 2012-12-08 16:28:14 · 548 阅读 · 0 评论 -
在已生成的数据表中,添加一列
public static DataSet addMc(ref DataSet ds) { ds.Tables[0].Columns.Add("sj"); foreach (DataRow row in ds.Tables[0].Rows) { row["sj"] = DateTi原创 2013-02-05 13:54:39 · 482 阅读 · 0 评论 -
如果每15分钟提交一次数据,则一天中应有96条数据。如有镂空,则补全没有提交的数据时间
/// /// 将DataSet个数补全至count个(日期或时间类型) /// /// 数据源 /// 要求补全的个数 /// 判断字段 /// 起始值 /// 时间类型(yyyy/MM/dd/hh/mm/ss) /// publ原创 2013-02-05 13:42:18 · 348 阅读 · 0 评论 -
输出信息到日志
1、在web.config里定义输出日志的位置。如下: 2、输出日志的类。如下: public class WriteLog { //加锁,满足多个用户同时调用 static object thisLock = new object(); public static void Writ原创 2012-11-14 14:39:08 · 348 阅读 · 0 评论 -
将生成的数据导出到指定的Excel模板中
/// /// 将数据填充到指定的excel表格中 /// /// /// /// /// public void DataSetToExcel(string filepath, string fileSavePath, DataSet ds)原创 2012-11-14 11:18:20 · 522 阅读 · 0 评论 -
获取下一次执行的时间
private DateTime GetNextTime() { int space =15 //判断间隔是否有效 if (space == 0) return DateTime.MaxValue; DateTime NextTime = DateTime.Parse(System.原创 2013-08-13 14:01:33 · 608 阅读 · 0 评论