摘要: 以下为我常用数据库访问的帮助类:View Code using System;using System.Data;using System.Data.SqlClient;using System.Configuration;using System.Collections.Generic; public static class DBHelper { // connection string public static readonly string connectionString = ConfigurationManager.ConnectionStrin... 阅读全文
posted @ 2013-03-08 09:27 小笔头大做用 阅读(240) 评论(0) 推荐(0) 编辑
摘要: 传出员工号等信息,查询此人是否在AD中存在:public bool ValidateEmpNoAndEmailId(string vEmpNo, string vEmailId) { DirectoryEntry rootEntry = new DirectoryEntry("LDAP://ad.home.com"); DirectorySearcher srch = new DirectorySearcher(rootEntry); srch.SearchScope = SearchScope.Subtree;//搜寻条件.... srch.Filter = " 阅读全文
posted @ 2013-03-08 09:23 小笔头大做用 阅读(273) 评论(0) 推荐(0) 编辑
摘要: 1 public string FilterSpecial(string str)//特殊字符过滤函数 2 { 3 if (str==null||str == "") //如果字符串为空,直接返回 4 { 5 return str; 6 } 7 else 8 { 9 str = str.Replace("'", "");10 str = str.Replace("<", "");11 str = str.... 阅读全文
posted @ 2013-02-28 09:31 小笔头大做用 阅读(272) 评论(0) 推荐(0) 编辑
摘要: 1 protected void CreateExcel(DataTable dt, string fileName) 2 { 3 System.Text.StringBuilder strb = new System.Text.StringBuilder(); 4 strb.Append(" <html xmlns:o=\"urn:schemas-microsoft-com:office:office\""); 5 strb.Append("xmlns:x=\"urn:schemas-microsoft-com:office: 阅读全文
posted @ 2013-02-28 09:28 小笔头大做用 阅读(358) 评论(0) 推荐(0) 编辑
摘要: 1.首先上传Excel 文件,和普通上传方法一样.2.导入Excel 里面的数据: 1 private bool ImportExcel() 2 { 3 bool bResult = true; 4 string filepath = ""; 5 string path = HttpContext.Current.Request.MapPath("~/UploadFiles/"); 6 try 7 { 8 DirectoryInfo di = new DirectoryInfo(p... 阅读全文
posted @ 2013-02-28 09:21 小笔头大做用 阅读(546) 评论(0) 推荐(0) 编辑