随笔分类 -  C#

C#编程的常见问题整理和分享
C#创建windows服务并发布
摘要:创建window 服务 新建一个window 服务项目MyService,如下图 切换到代码视图修改. [csharp] view plaincopy using System; using System.Collections.Generic; using System.ComponentMode 阅读全文
posted @ 2018-09-17 15:29 车车12138 阅读(276) 评论(0) 推荐(0)
C#实现多个PDF合并及去除文字水印功能
摘要:实现pdf合并就是使用Spire.Pdf.dll类库的方法,但是注意需要同时引用Spire.Pdf.dll和Spire.License.dll两个类库,且两个类库的版本要一致 但是使用spire的话合并成的pdf第一页会出现文字水印,这并不是我们要的,所以需要去除这个文字水印,那么就要用到iText 阅读全文
posted @ 2018-07-26 18:10 车车12138 阅读(2100) 评论(0) 推荐(0)
.Net的Excel 导出 格式设置
摘要:添加引用:Microsoft Excel 11.0 Object Library ;添加:using Microsoft.Office.Interop.Excel;一、打开Excel文件============================ Microsoft.Office.Interop.Exc... 阅读全文
posted @ 2015-02-05 17:31 车车12138 阅读(211) 评论(0) 推荐(0)
如何定义DATATABLE,同时赋值
摘要://定义一个TableDataTable dt=new DataTable("yeji");DataRow dr;DataColumn dc;//添加第0列dc=new DataColumn("店名",System.Type.GetType("System.String"));dt.Columns.... 阅读全文
posted @ 2015-01-26 11:53 车车12138 阅读(308) 评论(0) 推荐(0)
C# string类型和byte[]类型相互转换
摘要:string类型转成byte[]:byte[]byteArray=System.Text.Encoding.Default.GetBytes(str);byte[]转成string:stringstr=System.Text.Encoding.Default.GetString(byteArray)... 阅读全文
posted @ 2015-01-06 10:09 车车12138 阅读(242) 评论(0) 推荐(0)
ASP.Net将图片以二进制方式存入数据库,并读取
摘要:把图片转换成二进制--把二进制转换成图片 private void button1_Click(object sender, EventArgs e) { string path = this.textBox1.Text; by... 阅读全文
posted @ 2015-01-06 09:02 车车12138 阅读(763) 评论(0) 推荐(0)
C#中DataTable转换JSON
摘要:#region 将DataTable转换为json public string dt2json(DataTable dt) { JavaScriptSerializer jss = new JavaScriptSerializer(); ... 阅读全文
posted @ 2014-12-30 14:52 车车12138 阅读(410) 评论(0) 推荐(0)
C#中List集合转换JSON
摘要:#region 将List转换为Json public string List2JSON(List objlist, string classname) { string result = "{"; if (classname.... 阅读全文
posted @ 2014-12-30 14:51 车车12138 阅读(8782) 评论(0) 推荐(0)