摘要: 判断Window服务是否存在View Code public static bool ServiceIsExisted(string serviceName) { ServiceController[] servicesController = ServiceController.GetServices(); foreach (ServiceController each in servicesController) { if (each.ServiceName.ToLower().... 阅读全文
posted @ 2013-01-17 18:17 雇佣兵333 阅读(281) 评论(0) 推荐(0)
摘要: 读取Excel中数据到DataSetView Code static public DataSet ExcelToDataSet(string filename, DataSet ds) { //string strConn = " Provider = Microsoft.Jet.OLEDB.4.0 ; Data Source = " + filename + ";Extended Properties=Excel 8.0"; string strConn = " Provider = Microsoft.ACE.OLEDB.12.0... 阅读全文
posted @ 2013-01-17 17:46 雇佣兵333 阅读(282) 评论(0) 推荐(0)
摘要: 1.DataGrid的使用自动显示行号(修复删除行时行号显示不正确)View Code dgTool.LoadingRow += new EventHandler<DataGridRowEventArgs>(dgTool_LoadingRow); dgTool.UnloadingRow +=new EventHandler<DataGridRowEventArgs>(dgTool_UnloadingRow); void dgTool_LoadingRow(object sender, DataGridRowEventArgs e) { ... 阅读全文
posted @ 2013-01-17 17:07 雇佣兵333 阅读(3531) 评论(2) 推荐(3)
摘要: 将DataTable 转换List <T> 1)要求DataTable中的列名称必须和实体的属性名称相同 public static List<TResult> DataTableToList<TResult>(DataTable dt) where TResult : class,new() { //创建一个属性的列表 List<PropertyInfo> prlist = new List<PropertyInfo>(); //获取TResult的类型实例 反射的入口 ... 阅读全文
posted @ 2013-01-17 13:52 雇佣兵333 阅读(1627) 评论(0) 推荐(0)