09 2011 档案

线程间操作无效: 从不是创建控件的线程访问它
摘要:public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { Thread t = new Thread(SetTextBox); t.Start(); } private void SetTextBox() { //textBox1.Text = @"smart";//exc... 阅读全文

posted @ 2011-09-27 15:13 雨渐渐 阅读(221) 评论(0) 推荐(0) 编辑

SQLCMD.EXE
摘要:在博客园使用 windows live writerhttp://www.cnblogs.com/dudu/articles/495718.html第一篇 连本地实例SQLCMD.EXE -S .\sqlexpresswith t(n,m) as(select 1,getdate() union all select n+1,getdate()+n from t where n<10)select m from t;with date_series(d) as(select getdate() union all select getdate()+d+1 from date_series 阅读全文

posted @ 2011-09-17 17:08 雨渐渐 阅读(3316) 评论(1) 推荐(0) 编辑

函数:exec(sqlcommand)执行动态sql
摘要:declare @sql nvarchar(4000)set @sql='select getdate()'exec (@sql)核心:exec(sqlcommand)动态拼接sql命令,然后用exec(sqlcommand)执行该命令注:用这个写的存储过程所返回的结果集不知道能不能被客户端代码获得。---没空验证 阅读全文

posted @ 2011-09-15 17:37 雨渐渐 阅读(741) 评论(0) 推荐(0) 编辑

打印日期段间的每一天
摘要:需求:输入两个时间,打印出这两个日期间的所有天实现:declare @start datetime,@end datetimeset @start='20110830'set @end='20110918'while(@start<@end)beginprint CONVERT(nvarchar(8),@start,112)select @start=DATEADD(day,1,@start)end注:最近要写一些统计数据的sql,需要按天划分 阅读全文

posted @ 2011-09-14 22:48 雨渐渐 阅读(164) 评论(0) 推荐(0) 编辑

函数:isnull
摘要:问题:警告: 聚合或其他 SET 操作消除了 Null 值create table tb(id int,num int)insert into tb select 1,10insert into tb select 1,20insert into tb select 2,80insert into tb select 2,nullselect id,sum(num)from tbgroup by id警告: 聚合或其他 SET 操作消除了 Null 值。(2 行受影响)解决方案:select id,sum(isnull(num,0))from tbgroup by id结论:msdn说明:当 阅读全文

posted @ 2011-09-14 20:57 雨渐渐 阅读(371) 评论(0) 推荐(0) 编辑

导航