2014年2月12日

for xml path group by

摘要: select a.prodid,stuff((select '/'+pc.name from Product_ProductChannel ppc(nolock) inner join ProductChannel pc(nolock) on ppc.productchannelid=pc.id where ppc.prodid=a.prodid for xml path('')),1,1,'')from Product_ProductChannel a(nolock) inner join ProductChannel b(nolock) on 阅读全文

posted @ 2014-02-12 15:59 习惯简单 阅读(823) 评论(0) 推荐(0) 编辑

2014年1月13日

泛型对象Lists转xml

摘要: public static string ListtoXML(List lists) { if (lists.Count "; } StringBuilder xml = new StringBuilder(); T dt = lists[0]; System.Reflection.PropertyInfo[] pis = dt.GetType().GetProperties(); int count = pis.Length; ... 阅读全文

posted @ 2014-01-13 17:51 习惯简单 阅读(423) 评论(0) 推荐(0) 编辑

2013年12月25日

C# 打印功能

摘要: private void pd_PrintPage(object sender, PrintPageEventArgs e) { e.Graphics.DrawString("大家好", new Font("宋体", 10), new SolidBrush(System.Drawing.Color.Black), new PointF(10, 10)); Image image = Image.FromFile(@"D:\Chrysanthemum.jpg"); e.Graphics.DrawImage(image, new Poin 阅读全文

posted @ 2013-12-25 16:16 习惯简单 阅读(536) 评论(0) 推荐(0) 编辑

2013年11月14日

按照指定字符(@split )分割字符串,并取第@index 个

摘要: createfunction [dbo].[f_Get_StrArrayStrOfIndex_zsx] ( @str Nvarchar(max), --要分割的字符串 @split Nvarchar(1), --分隔符号 @index int --取第几个元素 ) returns varchar(1024) as begin set @str=@str+@split declare @result varchar(1024) declare @charindex int--当前位置 set @result= ''if @index=1 begin set @charindex= 阅读全文

posted @ 2013-11-14 17:30 习惯简单 阅读(2852) 评论(0) 推荐(0) 编辑

2013年10月12日

获取execl中所有的sheet名字

摘要: private static List GetExcelSheetNames(string filePath) { List names = new List(); Microsoft.Office.Interop.Excel.Application excelApp = null; object missing = System.Reflection.Missing.Value; try { excelApp = new Microsoft.Office.Interop.Excel.Application(); Microsoft.Office.Interop.Excel.Workbook. 阅读全文

posted @ 2013-10-12 16:25 习惯简单 阅读(1326) 评论(0) 推荐(0) 编辑

2013年9月24日

C#读取execl到datatable,设置execl单元格颜色

摘要: public class OperateExecl { //读取execl到datatablepublic static DataTable ReadFile(string path) { string strConn=""; if (Path.GetExtension(path).ToLower().Equals(".xlsx")) //Excel2007 { strConn = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + path + ";Extended Pr 阅读全文

posted @ 2013-09-24 16:06 习惯简单 阅读(1411) 评论(0) 推荐(0) 编辑

2013年6月28日

关于sql 语句的记录

摘要: 一、select 1 where 1 not in (2,3,null) 执行结果为空。解释:not in 当结果集中 有null的时候 直接返回 false。二、使用函数时,不会应用索引。 阅读全文

posted @ 2013-06-28 11:45 习惯简单 阅读(157) 评论(0) 推荐(0) 编辑

2013年6月27日

List转DataTable

摘要: public static DataTable ListToDT(List ls) { DataTable dt = new DataTable(); Type tp = typeof(T); PropertyInfo[] pinfo = tp.GetProperties(); foreach (PropertyInfo pi in pinfo) { dt.Columns.Add(pi.Name); } if (ls != null) { for (int i = 0; i < ls.Count; i++) { IList TempList = new ArrayList(); fore 阅读全文

posted @ 2013-06-27 11:48 习惯简单 阅读(208) 评论(0) 推荐(0) 编辑

2013年6月25日

生成 39 条形码

摘要: private Bitmap GetCode39(string strSource) { int x = 5; //左邊界 int y = 0; //上邊界 int WidLength = 2; //粗BarCode長度 int NarrowLength = 1; //細BarCode長度 int BarCodeHeight = 50; //BarCode高度 int intSourceLength = strSource.Length; string strEncode = "010010100"; //編碼字串 初值為 起始符號 * string AlphaBet = 阅读全文

posted @ 2013-06-25 17:39 习惯简单 阅读(242) 评论(0) 推荐(0) 编辑

2013年5月20日

抽象工厂理解

摘要: 定义:1、抽象产品:供具体产品继承并定义产品方法。2、具体产品:实现抽象产品的方法。3、抽象工厂:定义返回值为抽象产品的方法,供实现的具体工厂返回相应的具体产品。4、具体工厂:实现抽象工厂的方法,返回值不再是抽象产品,而是继承抽象产品的具体产品。1、public interface Iinsertdata { int insretdata(string data); } 2、public class TBinsretdata : Iinsertdata { public int insretdata(string data) { return 1; } }3、public in... 阅读全文

posted @ 2013-05-20 16:39 习惯简单 阅读(158) 评论(0) 推荐(0) 编辑

导航