- 博客(18)
- 资源 (1)
- 收藏
- 关注
原创 将Excel转换成CSV
需要添加引用:Microsoft.Office.Interop.Excelusing Excel = Microsoft.Office.Interop.Excel;调用:SaveAsExcel(@"D:\TEST.xls",@"D:\TEST.CSV"); /// /// 将Excel转换成CSV /// /// Excel路径 /// CSV要保存的路径 public static void S
2013-12-17 16:53:54
684
原创 根据年月日得到日期是星期几
string CaculateWeekDay(int y, int m, int d) { if (m == 1) { m = 13; y--; } if (m == 2) { m = 14; y--; } int week = (d + 2 * m + 3 * (m + 1) / 5 + y + y / 4 - y / 100 +
2012-06-12 15:57:22
279
原创 程序中进程的读取、关闭
根据进程名判断进程是否存在 : /// /// 判断进程是否存在 /// /// 进程名 /// 存在值变为>0 /// private bool GetProgram(string procName, out int count) {
2012-06-12 15:53:09
290
原创 SQL 行列转换
数据列转换成行。其中一列需要转换成行,因为列的值不确定所以用动态执行SQL @sql对象拼写出要转换行的列的值。 DECLARE @sql VARCHAR(1000)SELECT @sql = ISNULL(@sql + ',', '') + [ADVERTISE_NAME] FROM [TBL_ADVERTISE_MASTER]SELECT @sqlEXEC('
2012-05-31 10:00:21
282
原创 网页输出中文文档名乱码解决方式
string fileName = DateTime.Now.ToString("yyyyMMdd") + "中文名.xls"; string UserAgent = Request.ServerVariables["http_user_agent"].ToLower(); if (UserAgent.IndexOf("firefox") =
2012-02-23 17:58:54
310
原创 根据年月日得到日期是星期几
string CaculateWeekDay(int y, int m, int d) { if (m == 1) { m = 13; y--; } if (m == 2) { m = 14; y--; } int week = (d + 2 * m + 3 * (m + 1) / 5 + y + y / 4 - y / 100 +
2012-02-23 17:54:15
218
原创 ORDER BY CHARINDEX 语法
根据检索条件把检索结果排序。1、order by中包含的条件在其他数据之前:select * from 表名where 列名 in ('条件1','条件2','条件3','条件4')order by charindex(列名, '条件1,条件2,条件3') 2、order by中包含的条件在其他数据之后:select * from 表名where 列名 in (
2012-02-17 14:29:43
1649
原创 .NET面试常见题目
一、一列数字规则如下:1、1、2、3、5、8、13、21、34..........求第30位数是多少,用递归算法实现public class demo { /** * 实现方法 * @param i * @return */ public static int Foo(int i) { if (i
2012-02-16 16:18:08
288
原创 NPOI 生成Excel 的——常用
把自己常用的整理了出来,(*^__^*) 嘻嘻……有关文件输出文件名乱码的问题有设置Excel中的一些样式问题有直接保存Excel的 更多NPOI的实例说明:http://www.cnblogs.com/tonyqus/archive/2009/04/12/1434209.html 这个可是别个大虾滴。 using System;using System.Col
2011-12-15 16:58:44
1070
原创 读取.csv文件数据
using System.IO;private void UploadFile() { try { if (!FileUpload1.HasFile) { Response.Write("文件不存在"); return; } string fileExtension = Path.GetExtension(FileUpload1
2010-12-16 10:50:00
650
原创 GridView 生成Excel
private void ExportResult() { try { string filename = "text.xls"; HttpContext.Current.Response.Clear(); HttpContext.Current.Response.Charset = ""; HttpContext.Current.Response.AppendH
2010-12-09 10:13:00
562
原创 trigger and cursor
创建触发器创建一个基于table_name表的 添加/修改/删除 触发的事件操作定义游标读取数据打开游标循环游标中的数据赋值到变量在游标循环中处理数据结束后关闭游标并释放游标资源。语法:CREATE TRIGGER trigger_nameON table_nameFOR INSERT/UPDATE/DELETEASBEGIN SET NOCOUNT ON; DECLARE @val1 NVARCHAR(50),@val2 NVARCHAR(50) DECLARE @c
2010-12-07 11:15:00
307
原创 FileUpload图片上传 以及图片下载
private void UpImg() { string image = picFile.PostedFile.FileName; string imageType = image.Substring(image.LastIndexOf(".") + 1).ToUpper(); if (imageType == "JPG" || imageType == "JPEG" || imageType == "GIF" || imageType == "PNG"
2010-11-29 15:49:00
565
原创 GridView生成.csv文件
string filename=DateTime.Now.ToString()+".csv";int rowCount = gridViewDL.Rows.Count + 1;int colCount = gridViewDL.Columns.Count;string[] arr = new string[colCount];StringWriter fileWriter = new StringWriter();//标题设置arr[0]="";arr[1]="";arr[2]="";fileWriter.
2010-11-26 17:32:00
624
原创 .net 自带 发邮件
using System.Net.Mail; /// /// 发送邮件程序 /// /// 发送人邮件地址 /// 发送人显示名称 /// 发送给谁(邮件地址) /// 标题 /// 内容 /// 邮件登录名 /// 邮件密码 /// 邮件服务器 ///
2010-11-26 17:30:00
380
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人