随笔分类 -  C#

摘要:快速导出CSVprotected void btnQuery_Click(object sender, EventArgs e) { try { DataTable dt = _bll.GetCompanys(this.txtBegin.Text, this.txtEnd.Text); //DataTableToCSV(columns, dt); string data = Export(dt); string temp = string.Format("attachment;filename={0}", "ExportData.csv"); Respo 阅读全文
posted @ 2011-10-21 15:09 李帅斌-Memory 阅读(364) 评论(0) 推荐(0)
摘要:TransactionScope是的.net Framework2.0版本中增加的一个新命名空间。他的用途是为数据库访问提供一个“轻量级”的事物。使用时要添加System.Transactions.dll的引用示例代码如下:using(TransactionScope scope = new TransactionScope()){  //Query  using(SqlConnection conn = new SqlConnection(connString))  {    SqlCommand cmd = new SqlCommand(sqlQuery,conn);    conn.op 阅读全文
posted @ 2011-01-21 15:05 李帅斌-Memory 阅读(750) 评论(0) 推荐(1)
摘要:最近安装的IE8浏览器,今天打开VisualStudio想调试一个程序,发现程序运行时,打开IE页面后,Debug启动,很快就关闭了。在网上遍寻解决方案,终于找到了。解决办法如下:在程序运行中输入regedit打开注册表,选择HKEY_LOCAL_MACHINE->SOFTWARE->Microsoft->Internet Explorer->Main在Main点击右键新建... 阅读全文
posted @ 2009-07-17 18:10 李帅斌-Memory 阅读(600) 评论(0) 推荐(0)
摘要:using System; using System.IO; using System.Runtime.InteropServices; using System.Text; usingMicrosoft.Win32;///<summary>///HardDiskVal的摘要说明。///读取指定盘符的硬盘序列号///功能:读取指定盘符的硬盘序列号///</summary>p... 阅读全文
posted @ 2009-02-21 22:25 李帅斌-Memory 阅读(1112) 评论(0) 推荐(0)
摘要:前段时间写的导出word文档程序,遇到一个奇怪的文件,在开发环境里运行,点击导出word文件时,能够顺利导出,并保存。但是关闭开发环境,用IIS运行程序时,报错。错误提示:word内在不足,请现在保存文档。于是在网上遍找原因,发现提问相同问题的人很多,但是没有找到一个回答的答案。  后来在一个论坛里,有人提示说是web.config设置是不是有问题。于是,查看web.config,发现配置节<... 阅读全文
posted @ 2009-02-12 22:49 李帅斌-Memory 阅读(5232) 评论(1) 推荐(0)
摘要://冒泡排序法 private void SortArray() { //从大到小排列 int[] Arr = new int[] { 8, 4, 9, 5, 3, 2, 6, 7, 1 }; for (int i = 1; i "); } //从小到大排列 for ... 阅读全文
posted @ 2008-12-01 10:29 李帅斌-Memory 阅读(1101) 评论(3) 推荐(0)