2012年4月19日

C#备份和还原sql server数据库

摘要: View Code 1 using System; 2 using System.Data; 3 using System.Data.SqlClient; 4 5 namespace Commom 6 { 7 /// <summary> 8 /// 备份和还原sql server 2005数据库,在.net2.0中文正式版和sql server 2005系统上通过 9 /// </summary> 10 public class BackupData 11 { 12 private SqlC... 阅读全文

posted @ 2012-04-19 01:19 comcyd 阅读(338) 评论(1) 推荐(1)

Web Service 的发布和编译调用

摘要: 1.发布 wsdl http://192.168.1.100/webservice/xxx.asmx?wsdl2.编译成(Service.dll)供调用 csc /t:library /out Service.dll Service.cs 阅读全文

posted @ 2012-04-19 01:19 comcyd 阅读(200) 评论(0) 推荐(0)

WinForm可拖动的窗体

摘要: View Code 1 //全局 2 3 private int sx = 0; 4 private int sy = 0; 5 6 7 8 //窗体事件 9 10 private void PlayerForm_MouseDown(object sender, MouseEventArgs e)11 {12 this.sx = e.X;13 this.sy = e.Y;14 }15 16 private void PlayerForm_MouseMove(object sender, MouseEventArgs e)17 {18 ... 阅读全文

posted @ 2012-04-19 01:17 comcyd 阅读(321) 评论(0) 推荐(1)

存储过程里构建模糊查询,引号的处理

摘要: set @strSql=@strSql+' where fk like ''%'+@fk+'%''' 阅读全文

posted @ 2012-04-19 01:16 comcyd 阅读(156) 评论(0) 推荐(0)

TextBox输入后敲击回车触发事件

摘要: 1 private void tstbname_KeyPress(object sender, KeyPressEventArgs e)2 {3 if (e.KeyChar == 13)4 {5 MessageBox.Show("哈哈");6 }7 } 阅读全文

posted @ 2012-04-19 01:14 comcyd 阅读(685) 评论(0) 推荐(0)

C#本地DataTable的筛选,类似DB的Select

摘要: 非常简单,一行代码就能表述:dt为数据库里查询出来的DataTable,其它key为dt里的字段名:DataRow[] dt_tmp = dt.Select("where key='fuck'"); 阅读全文

posted @ 2012-04-19 01:12 comcyd 阅读(245) 评论(0) 推荐(0)

删除处理触发器(同步删除被删除节点的所有子节点)

摘要: View Code 1 --删除处理触发器(同步删除被删除节点的所有子节点) 2 3 create trigger tr_deletenode on tbc 4 5 for delete 6 7 as 8 9 if @@rowcount=0 return --如果没有满足删除条件的记录,直接退出10 11 --查找所有被删除节点的子节点12 13 declare @t table(id int,level int)14 15 declare @level int16 17 set @level=118 19 insert @t select a.id,@level20 21 from... 阅读全文

posted @ 2012-04-19 01:10 comcyd 阅读(171) 评论(0) 推荐(0)

SQL with etc获取父节点或子节点总结

摘要: View Code 1 获取节点的所有父节点 2 ;with 3 #tmp as( 4 select * from tb 5 where id = 'DMA20120327036' 6 union all 7 select a.* from tb a, #tmp b 8 where a.id = b.pid 9 ) 10 select * from #tmp11 12 获取节点的所有子节点13 ;with 14 #tmp as( 15 select * from tb16 where id ... 阅读全文

posted @ 2012-04-19 01:08 comcyd 阅读(287) 评论(0) 推荐(0)

用线程来更新UI防界面假死的方法

摘要: 1.使用Application.DoEvents();2.使用委托delegate3.使用BackgroundWorker; 最偷懒的办法(Winform/Silverlight通用) 4.设置Control.CheckForIllegalCrossThreadCalls为false,相当于不检测线程之间的冲突5.Dispatcher.BeginInvoke--Silverlight的独门秘籍 阅读全文

posted @ 2012-04-19 01:06 comcyd 阅读(283) 评论(0) 推荐(0)

C#多线程与UI响应

摘要: 转自某大牛的转载软件界面的响应特性是判断一款软件的非常重要的方面。一般来说,不管你软件功能做得有多么奇妙,如果软件有一点点死机的感觉都会让用户感到很讨厌,甚至怀疑你软件里是否藏有更大的问题。要提高界面的响应特性,最好的办法莫过于使用多线程,并把呈现界面的线程独立出来。以前只有使用C++才能实现的多线程功能,现在在.Net框架下,所有的语言(包括VB)都可以使用了。不过,使用多线程比使用单一线程要麻烦得多,比如线程之间的同步问题,做得不好很容易出错,而有的时候这种错误要开发人员花上几个星期的时间才能找到。在Windows Form软件中使用多线程更是有一些限制。下面我们就把在Windows Fo 阅读全文

posted @ 2012-04-19 01:05 comcyd 阅读(302) 评论(0) 推荐(0)

导航