雁过请留痕...
代码改变世界

sql行列旋转

2014-01-03 14:54 by xiashengwang, 4137 阅读, 0 推荐, 收藏, 编辑
摘要:一,行转列先建立测试数据if OBJECT_ID('week_income') is not nulldrop table week_incomegocreate table week_income( employee varchar(10), weekname varchar(10), income int)goinsert into week_incomeselect '張三','星期一',1000 union allselect '張三','星期二',2000 union allselect '張三& 阅读全文

vba的一个File操作类

2014-01-02 16:04 by xiashengwang, 2561 阅读, 0 推荐, 收藏, 编辑
摘要:Option Explicit'--------------------------------------------------------'[Class name]: clsTxtFile'[Description]: Read Or Write Txt File'--------------------------------------------------------Private mFileNumber As IntegerPrivate mIsOpen As BooleanPrivate mEncoding As StringPrivate m 阅读全文

vba的一个DB操作类

2014-01-02 15:50 by xiashengwang, 1546 阅读, 1 推荐, 收藏, 编辑
摘要:Option Explicit'--------------------------------------------------------'[Class Name]: DBHelper'[Description]: databse access class'--------------------------------------------------------'variablePrivate mConn As ADODB.ConnectionPrivate mIsOpen As BooleanPrivate mIsBeginTran As 阅读全文

sql临时表,表变量,CTE,游标使用方法

2014-01-02 15:34 by xiashengwang, 477 阅读, 0 推荐, 收藏, 编辑
摘要:if OBJECT_ID('groups') is not null drop table groupscreate table groups( groupid varchar(10), val int null)insert into groups values('a','1');insert into groups values('a','2');insert into groups values('a','3');insert into groups values('b 阅读全文

Excel数据批量导入到SqlServer的方法

2013-12-23 18:03 by xiashengwang, 10943 阅读, 1 推荐, 收藏, 编辑
摘要:1,以Excel为数据源建立连接导入。关键点在于Excel的数据要有表头,表头要和数据库表的列名一样。连接字符串中HDR=YES不能省略,也就是第一行是表头的意思。IMEX=1;是把数据都当作字符串读取。Sub test() Dim cn As ADODB.Connection Dim strSQL As String Dim lngRecsAff As Long Dim Headers As Boolean Dim strConn As String Dim path As String On Error GoTo test_Err... 阅读全文

VBA中数据库导出数据到Excel注意事项

2013-12-03 18:35 by xiashengwang, 2740 阅读, 0 推荐, 收藏, 编辑
摘要:Sub ReadDBData() On Error GoTo ErrorHand Dim dbHelper As New dbHelper Dim sqlSQL As String Dim rs As ADODB.Recordset Dim row As Integer If dbHelper.OpenConnection(GetConnString()) Then sqlSQL = "select top(500) * from View_Column" Set rs = dbHelper.ExecuteReco... 阅读全文

枚举Enum和常量0之间的恩怨

2013-11-29 15:13 by xiashengwang, 2682 阅读, 0 推荐, 收藏, 编辑
摘要:1,任何为0的常量表达式都能隐式的转换成枚举Enum。对于这一点,在程序中没少吃苦头。特别是对于函数重载的情况,往往让人一头雾水。看看下面的代码(摘自MSDN),你能猜到输出吗?public enum E{ Zero = 0, One = 1,} class A{ public A(string s, object o) { System.Console.WriteLine("{0} => A(object)", s); } public A(string s, E e) { System.Console.WriteLine("{0} => A(Enu 阅读全文

Lamda表达式的参数捕获,太酷了

2013-11-28 11:22 by xiashengwang, 6378 阅读, 0 推荐, 收藏, 编辑
摘要:lamda表达式有了参数捕获这个功能,让Action这个委托变得无所不能。Action委托就是无参数,无返回值的一个代理类型。它只能对应于下面这种类型的函数声明。 public void Function() { //Do something } public void Function2() { //Do something } public void Function3() { //Do something }假设我们定义一个共通的执行... 阅读全文

IIS7上传文件大小設定

2013-09-29 15:24 by xiashengwang, 465 阅读, 0 推荐, 收藏, 编辑
摘要:1、首先、修改Web.Config中的maxRequestLength、单位是KB;executionTimeout单位是秒。例:maxRequestLength=1024(1MB)executionTimeout=3600(60分) 2、上面设定好后、Web.Config的maxAllowedContentLength也必须要设定。单位:Byte、下面的例子设定大小为:1G。 注意:要使2的設定生效,要确保C:\Windows\System32\inetsrv\config\applicationhost.config中的下面的节点为“Allow”。modify the ov... 阅读全文

.Net中的内存分配问题

2013-09-29 15:13 by xiashengwang, 584 阅读, 0 推荐, 收藏, 编辑
摘要:最近在测试的时候,要求测试内存不足的情况。我不想去开很多的程序来占用内存,那样太麻烦了,也不太精确。于是就写一个小程序来占用内存,想法很简单,就是声明一个Byte数组在占用内存,没想到这么简单的想法却没能正常工作,出乎我的所料,经过一番折腾,终于搞清楚了原因。using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows. 阅读全文
上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 19 下一页