自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(20)
  • 资源 (8)
  • 收藏
  • 关注

原创 linux 安装redis、配置密码及简单使用

linux 安装redis、配置密码及简单使用

2023-07-16 22:06:59 297

原创 mysql修改密码

mysql修改密码

2023-07-16 14:10:16 677

原创 VS2017创建空白解决方案

文件=》项目=》其他项目类型=》VisualStudio解决方案=》确定

2018-03-15 14:45:41 14057

原创 zTree 使用笔记

1 核心文件核心文件:核心包 ( jquery.ztree.core-3.x.js )两个扩展包:复选框功能包 ( jquery.ztree.excheck-3.x.js )编辑功能包 ( jquery.ztree.exedit-3.x.js )合并包= 核心包 + 两个扩展包(jquery.ztree.all-3.x.js)使用 zTree v3.x 时,核心包必须加

2016-01-31 18:04:03 1682

原创 解决Ajax(jsonp)跨域访问问题

JSONP(JSON with Padding)是JSON的 一种“使用模式”,可用于解决主流浏览器的跨域数据访问的问题。由于同源策略,一般来说位于 A服务器的网页无法与B的服务器沟通,而 HTML 的 元素是一个例外。利用 元素的这个开放策略,网页可以得到从其他来源动态产生的 JSON 资料,而这种使用模式就是所谓的 JSONP。用 JSONP 抓到的资料并不是 JSON,而是任意的Jav

2016-01-28 00:16:45 351

原创 程序集重新定向与指定加载程序集时公共语言运行时搜索的子目录。

重新运行时程序集版本号与文件重新定向

2015-12-18 15:34:42 310

原创 js 动态为textbox添加下拉框数据源

$("#").change(function () {                $("#").val("");//qing                $("#").unautocomplete();                $("#").autocomplete('Ajax/AjaxCusCarEssentialVersion.aspx', {           

2014-04-23 17:27:39 807

原创 JQuery的Ajax跨域请求的解决方案

跨域请求

2014-04-19 07:29:49 888

原创 压缩修复Access数据库

using JRO //引用 public void Compact(string mdbPath)        {            if (!File.Exists(mdbPath))            {                throw new Exception("目标数据库不存在,无法压缩!");            }       

2014-01-14 18:57:30 1079

转载 并发访问Access数据库(局域网)

1.      首先把程序折分,分成一个前台程序,一个后台数据库。         利用ACCESS的数据库拆分向导可以很轻松的做到把数据库分为前台与后台两个部分,前台保留除表之外的所有对象,包括:查询、窗体、报表、宏或代码,并且自动链接了后台数据库的表;而后台只保留了表对象。         打开数据库-工具-数据库实用工具-折分数据库         在弹出“数据库拆分器”后单击“

2014-01-14 15:58:57 6134

原创 ftp支持进度条上传

//         /// 将本地文件上传到指定的服务器(HttpWebRequest方法)        ///         /// 文件上传到的服务器        /// 要上传的本地文件(全路径)        /// 文件上传后的名称        /// 上传进度条        /// 成功返回1,失败返回0        private int

2013-11-28 16:41:43 962

原创 zip 压缩与解压缩

///         /// 压缩文件        ///         /// 要进行压缩的文件名        /// 压缩后生成的压缩文件名        ///         public static bool ZipFile(string FileToZip, string ZipedFile, String Password)        {

2013-11-28 16:08:06 606

原创 c# 高效的分页查询

//高效的分页查询SELECT TOP "+ PageSize +" * FORM ( SELECT TOP "+ PageSize * PageId +" ProductName,ProducntCode From Product ORDER BY ID DESC)ORDER BY ID ASC

2013-11-28 15:59:49 1282

原创 Ftp上传

public sealed class FtpClientService    {        private WaittingForm _waittingForm;        public WaittingForm WaittingForm {            get { return _waittingForm ?? (_waittingForm = new Wai

2013-11-28 15:50:34 578

原创 c# excel 创建Sheet并绑定DataTable

#region 变量        Application xlApp = null;        Workbooks wbs = null;        Workbook wb = null;        private int _rowindex = 0;//全局行索引(使用时加n行)          //要导出的表集合          private L

2013-11-28 15:42:47 2583

原创 c# 操作Excel单元格属性

range.NumberFormatLocal = "@";     //设置单元格格式为文本range = (Range)worksheet.get_Range("A1", "E1");     //获取Excel多个单元格区域:本例做为Excel表头range.Merge(0);     //单元格合并动作worksheet.Cells[1, 1] = "Excel单元格赋值"; 

2013-11-28 15:29:35 4814

原创 TreeView 动态绑定数据源

using System;using System.Collections.Generic;using System.Data;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;namespace TreeViewWeb{    publi

2013-08-04 18:01:42 919

原创 excel导出、导入

using Microsoft.Office.Interop.Excel;using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Data.OleDb;using System.Data.SqlClient;using

2013-08-04 12:37:06 676

原创 T-SQL循环语句

declare @num intselect @num = 0while @num beginselect @num = @num +1;insert into person(ContactID,FirstName,LastName,EmailAddress) values(@num,'FirstName'+cast(@num as varchar(10)),'LastName

2013-08-03 17:47:14 3643

原创 sql查询语句(将一个表的列变成行显示)

CREATE TABLE tb(name VARCHAR(10) , course VARCHAR(10) , score INT)INSERT INTO tb(name,course,score) VALUES('张三' , '语文' , 74),('张三' , '数学' , 83),('张三' , '物理' , 93),('李四' , '语文' , 74),('李四'

2013-07-03 10:59:37 2352

多表关联更新数据

sqlserver,oracle,mysql多表关联更新数据

2014-10-20

序列化和反序列化会出现“k_BackingField”

序列化和反序列化会出现“k_BackingField”

2014-06-12

asp.net导出,导入Excel

asp.net 导 出 ,导 入 Excel

2014-05-12

DataGridView

自定义DataGridViewColumn(文本加图片、或下拉框等)

2013-12-12

WebBrowser 打印

winform 使用webBrowser控件 打印,利用拼接字符串格式填充html标记 并添加javascript 函数 在后台程序中调用

2013-11-28

zip压缩大全

zip压缩相关 1using System; 2using System.Collections.Generic; 3using System.Text; 4using System.IO; 5using ICSharpCode.SharpZipLib; 6using ICSharpCode.SharpZipLib.Zip; 7using ICSharpCode.SharpZipLib.Checksums; 8 9/* 10 * 解压缩 11 * 该程序压缩和解压配合才能使用 12 * 普通用 Winrar 压缩的文件该解压不能通过 13 * Modify By HJ 2007-10-25 14 */ 15namespace ZipApplication 16{ 17 /// <summary> 18 /// 压缩类 19 /// </summary> 20 public class ZipClass 21 { 22 /// <summary> 23 /// 递归压缩文件夹方法 24 /// </summary> 25 /// <param name="FolderToZip"></param> 26 /// <param name="s"></param> 27 /// <param name="ParentFolderName"></param> 28 private static bool ZipFileDictory(string FolderToZip, ZipOutputStream s, string ParentFolderName) 29 { 30 bool res = true; 31 string[] folders, filenames; 32 ZipEntry entry = null; 33 FileStream fs = null; 34 Crc32 crc = new Crc32(); 35 36 try 37 { 38 39 //创建当前文件夹 40 entry = new ZipEntry(Path.Combine(ParentFolderName, Path.GetFileName(FolderToZip) + "/")); //加上 “/” 才会当成是文件夹创建 41 s.PutNextEntry(entry); 42 s.Flush(); 43 44 45 //先压缩文件,再递归压缩文件夹 46 filenames = Directory.GetFiles(FolderToZip); 47 foreach (string file in filenames) 48 { 49 //打开压缩文件 50 fs = File.OpenRead(file); 51 52 byte[] buffer = new byte[fs.Length]; 53 fs.Read(buffer, 0, buffer.Length); 54 entry = new ZipEntry(Path.Combine(ParentFolderName, Path.GetFileName(FolderToZip) + "/" + Path.GetFileName(file))); 55 56 entry.DateTime = DateTime.Now; 57 entry.Size = fs.Length; 58 fs.Close(); 59 60 crc.Reset(); 61 crc.Update(buffer); 62 63 entry.Crc = crc.Value; 64 65 s.PutNextEntry(entry); 66 67 s.Write(buffer, 0, buffer.Length); 68 } 69 } 70 catch 71 { 72 res = false; 73 } 74 finally 75 { 76 if (fs != null) 77 { 78 fs.Close(); 79 fs = null; 80 } 81 if (entry != null) 82 { 83 entry = null; 84 } 85 GC.Collect(); 86 GC.Collect(1); 87 } 88 89 90 folders = Directory.GetDirectories(FolderToZip); 91 foreach (string folder in folders) 92 { 93 if (!ZipFileDictory(folder, s, Path.Combine(ParentFolderName, Path.GetFileName(FolderToZip)))) 94 { 95 return false; 96 } 97 } 98 99 return res; 100 } 101 102 /// <summary> 103 /// 压缩目录 104 /// </summary> 105 /// <param name="FolderToZip">待压缩的文件夹,全路径格式</param> 106 /// <param name="ZipedFile">压缩后的文件名,全路径格式</param> 107 /// <returns></returns> 108 private static bool ZipFileDictory(string FolderToZip, string ZipedFile, String Password) 109 { 110 bool res; 111 if (!Directory.Exists(FolderToZip)) 112 { 113 return false; 114 } 115 116 ZipOutputStream s = new ZipOutputStream(File.Create(ZipedFile)); 117 s.SetLevel(6); 118 s.Password = Password; 119 120 res = ZipFileDictory(FolderToZip, s, ""); 121 122 s.Finish(); 123 s.Close(); 124 125 return res; 126 } 127 128 /// <summary> 129 /// 压缩文件 130 /// </summary> 131 /// <param name="FileToZip">要进行压缩的文件名</param> 132 /// <param name="ZipedFile">压缩后生成的压缩文件名</param> 133 /// <returns></returns> 134 private static bool ZipFile(string FileToZip, string ZipedFile, String Password) 135 { 136 //如果文件没有找到,则报错 137 if (!File.Exists(FileToZip)) 138 { 139 throw new System.IO.FileNotFoundException("指定要压缩的文件: " + FileToZip + " 不存在!"); 140 } 141 //FileStream fs = null; 142 FileStream ZipFile = null; 143 ZipOutputStream ZipStream = null; 144 ZipEntry ZipEntry = null; 145 146 bool res = true; 147 try 148 { 149 ZipFile = File.OpenRead(FileToZip); 150 byte[] buffer = new byte[ZipFile.Length]; 151 ZipFile.Read(buffer, 0, buffer.Length); 152 ZipFile.Close(); 153 154 ZipFile = File.Create(ZipedFile); 155 ZipStream = new ZipOutputStream(ZipFile); 156 ZipStream.Password = Password; 157 ZipEntry = new ZipEntry(Path.GetFileName(FileToZip)); 158 ZipStream.PutNextEntry(ZipEntry); 159 ZipStream.SetLevel(6); 160 161 ZipStream.Write(buffer, 0, buffer.Length); 162 } 163 catch 164 { 165 res = false; 166 } 167 finally 168 { 169 if (ZipEntry != null) 170 { 171 ZipEntry = null; 172 } 173 if (ZipStream != null) 174 { 175 ZipStream.Finish(); 176 ZipStream.Close(); 177 } 178 if (ZipFile != null) 179 { 180 ZipFile.Close(); 181 ZipFile = null; 182 } 183 GC.Collect(); 184 GC.Collect(1); 185 } 186 187 return res; 188 } 189 190 /// <summary> 191 /// 压缩文件 和 文件夹 192 /// </summary> 193 /// <param name="FileToZip">待压缩的文件或文件夹,全路径格式</param> 194 /// <param name="ZipedFile">压缩后生成的压缩文件名,全路径格式</param> 195 /// <returns></returns> 196 public static bool Zip(String FileToZip, String ZipedFile, String Password) 197 { 198 if (Directory.Exists(FileToZip)) 199 { 200 return ZipFileDictory(FileToZip, ZipedFile, Password); 201 } 202 else if (File.Exists(FileToZip)) 203 { 204 return ZipFile(FileToZip, ZipedFile, Password); 205 } 206 else 207 { 208 return false; 209 } 210 } 211 } 212 /// <summary> /// 解压类 /// </summary> public class UnZipClass { /// <summary> /// 解压功能(解压压缩文件到指定目录) /// </summary> /// <param name="FileToUpZip">待解压的文件</param> /// <param name="ZipedFolder">指定解压目标目录</param> public static void UnZip(string FileToUpZip, string ZipedFolder,string Password) { if (!File.Exists(FileToUpZip)) { return; } if (!Directory.Exists(ZipedFolder)) { Directory.CreateDirectory(ZipedFolder); } ZipInputStream s = null; ZipEntry theEntry = null; string fileName; FileStream streamWriter = null; try { s = new ZipInputStream(File.OpenRead(FileToUpZip)); s.Password = Password; while ((theEntry = s.GetNextEntry()) != null) { if (theEntry.Name != String.Empty) { fileName = Path.Combine(ZipedFolder, theEntry.Name); ///判断文件路径是否是文件夹 if (fileName.EndsWith("/") || fileName.EndsWith("\\")) { Directory.CreateDirectory(fileName); continue; } streamWriter = File.Create(fileName); int size = 2048; byte[] data = new byte[2048]; while (true) { size = s.Read(data, 0, data.Length); if (size > 0) { streamWriter.Write(data, 0, size); } else { break; } } } } } finally { if (streamWriter != null) { streamWriter.Close(); streamWriter = null; } if (theEntry != null) { theEntry = null; } if (s != null) { s.Close(); s = null; } GC.Collect(); GC.Collect(1); } } } }

2013-11-28

c# 操作Excel单元格属性

range.NumberFormatLocal = "@"; //设置单元格格式为文本 range = (Range)worksheet.get_Range("A1", "E1"); //获取Excel多个单元格区域:本例做为Excel表头 range.Merge(0); //单元格合并动作 worksheet.Cells[1, 1] = "Excel单元格赋值"; //Excel单元格赋值 range.Font.Size = 15; //设置字体大小 range.Font.Underline=true; //设置字体是否有下划线 range.Font.Name="黑体"; 设置字体的种类 range.HorizontalAlignment=XlHAlign.xlHAlignCenter; //设置字体在单元格内的对其方式 range.ColumnWidth=15; //设置单元格的宽度 range.Cells.Interior.Color=System.Drawing.Color.FromArgb(255,204,153).ToArgb(); //设置单元格的背景色 range.Borders.LineStyle=1; //设置单元格边框的粗细 range.BorderAround(XlLineStyle.xlContinuous,XlBorderWeight.xlThick,XlColorIndex.xlColorIndexAutomatic,System.Drawing.Color.Black.ToArgb()); //给单元格加边框 range.Borders.get_Item(Microsoft.Office.Interop.Excel.XlBordersIndex.xlEdgeTop).LineStyle = Microsoft.Office.Interop.Excel.XlLineStyle.xlLineStyleNone; //设置单元格上边框为无边框 range.EntireColumn.AutoFit(); //自动调整列宽 Range.HorizontalAlignment= xlCenter; // 文本水平居中方式 Range.VerticalAlignment= xlCenter //文本垂直居中方式 Range.WrapText=true; //文本自动换行 Range.Interior.ColorIndex=39; //填充颜色为淡紫色 Range.Font.Color=clBlue; //字体颜色 xlsApp.DisplayAlerts=false; //保存Excel的时候,不弹出是否保存的窗口直接进行保存 ==================================================================== using System; using System.Collections.Generic; using System.Text; using System.Reflection; using System.Runtime.InteropServices; using Microsoft.Office.Interop.Excel; using ExcelApplication = Microsoft.Office.Interop.Excel.ApplicationClass; using System.IO; namespace ExcalDemo { public class ExcelFiles { public void CreateExcelFiles() { ExcelApplication excel = new ExcelApplication(); try { excel.Visible = false;// 不显示 Excel 文件,如果为 true 则显示 Excel 文件 excel.Workbooks.Add(Missing.Value);// 添加工作簿 Worksheet sheet = (Worksheet)excel.ActiveSheet;// 获取当前工作表 Range range = null;// 创建一个空的单元格对象 range = sheet.get_Range("A1", Missing.Value);// 获取单个单元格 range.RowHeight = 20; // 设置行高 range.ColumnWidth = 20; // 设置列宽 range.Borders.LineStyle = 1; // 设置单元格边框 range.Font.Bold = true; // 加粗字体 range.Font.Size = 20; // 设置字体大小 range.Font.ColorIndex = 5; // 设置字体颜色 range.Interior.ColorIndex = 6; // 设置单元格背景色 range.HorizontalAlignment = XlHAlign.xlHAlignCenter;// 设置单元格水平居中 range.VerticalAlignment = XlVAlign.xlVAlignCenter;// 设置单元格垂直居中 range.Value2 = "设置行高和列宽";// 设置单元格的值 range = sheet.get_Range("B2", "D4");// 获取多个单元格 range.Merge(Missing.Value); // 合并单元格 range.Columns.AutoFit(); // 设置列宽为自动适应 range.NumberFormatLocal = "#,##0.00";// 设置单元格格式为货币格式 // 设置单元格左边框加粗 range.Borders[XlBordersIndex.xlEdgeLeft].Weight = XlBorderWeight.xlThick; // 设置单元格右边框加粗 range.Borders[XlBordersIndex.xlEdgeRight].Weight = XlBorderWeight.xlThick; range.Value2 = "合并单元格"; // 页面设置 sheet.PageSetup.PaperSize = XlPaperSize.xlPaperA4; // 设置页面大小为A4 sheet.PageSetup.Orientation = XlPageOrientation.xlPortrait; // 设置垂直版面 sheet.PageSetup.HeaderMargin = 0.0; // 设置页眉边距 sheet.PageSetup.FooterMargin = 0.0; // 设置页脚边距 sheet.PageSetup.LeftMargin = excel.InchesToPoints(0.354330708661417); // 设置左边距 sheet.PageSetup.RightMargin = excel.InchesToPoints(0.354330708661417);// 设置右边距 sheet.PageSetup.TopMargin = excel.InchesToPoints(0.393700787401575); // 设置上边距 sheet.PageSetup.BottomMargin = excel.InchesToPoints(0.393700787401575);// 设置下边距 sheet.PageSetup.CenterHorizontally = true; // 设置水平居中 // 打印文件 sheet.PrintOut(Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value); // 保存文件到程序运行目录下 sheet.SaveAs(Path.Combine(System.Windows.Forms.Application.StartupPath,"demo.xls"), Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value); excel.ActiveWorkbook.Close(false, null, null); // 关闭 Excel 文件且不保存 } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { excel.Quit(); // 退出 Excel excel = null; // 将 Excel 实例设置为空 } } } }

2013-11-28

CodeSmith6.5

codesmith6.5.0破解版本不包含注册机

2013-10-16

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除