易截截图软件、单文件、免安装、纯绿色、仅160KB

C#Windows服务程序的快速开发


C#Windows服务程序的快速开发向你介绍了在很多应用中需要做windows服务来操作数据库等操作,希望对你了解C#Windows服务程序的开发有所帮助。
C#Windows服务程序的快速开发:在很多应用中需要做windows服务来操作数据库等操作,比如
(1)一些非常慢的数据库操作,不想一次性去做,想慢慢的通过服务定时去做,比如定时为数据库备份等
(2)在.net Remoting中利用windows服务来做Host
利用vs.net我们可以在几分钟之内建立其windows服务,非常简单
下面说一下C#Windows服务程序的快速开发的步骤
C#Windows服务程序的快速开发1. 新建一个项目
C#Windows服务程序的快速开发2. 从一个可用的项目模板列表当中选择Windows服务
C#Windows服务程序的快速开发3. 设计器会以设计模式打开
C#Windows服务程序的快速开发4. 从工具箱的组件表当中拖动一个Timer对象到这个设计表面上 (注意: 要确保是从组件列表而不是从Windows窗体列表当中使用Timer)
C#Windows服务程序的快速开发5. 设置Timer属性,Interval属性200毫秒(1秒进行5次数据库操作)
C#Windows服务程序的快速开发6. 然后为这个服务填加功能
C#Windows服务程序的快速开发7.双击这个Timer,然后在里面写一些数据库操作的代码,比如
SqlConnection conn=new SqlConnection(  server=127.0.0.1;database=test;uid=sa;pwd=275280");    SqlCommand comm=-new SqlCommand(  insert into tb1 ('111',11)",conn);    conn.Open();    comm.ExecuteNonQuery();    conn.Close(); 
C#Windows服务程序的快速开发8. 将这个服务程序切换到设计视图
C#Windows服务程序的快速开发9. 右击设计视图选择“添加安装程序”
C#Windows服务程序的快速开发10. 切换到刚被添加的ProjectInstaller的设计视图
C#Windows服务程序的快速开发11. 设置serviceInstaller1组件的属性:
1) ServiceName = My Sample Service
2) StartType = Automatic (开机自动运行)
C#Windows服务程序的快速开发12. 设置serviceProcessInstaller1组件的属性  Account = LocalSystem
C#Windows服务程序的快速开发13. 改变路径到你项目所在的bin\Debug文件夹位置(如果你以Release模式编译则在bin\Release文件夹)
C#Windows服务程序的快速开发14. 执行命令“InstallUtil.exe MyWindowsService.e


相关文档:

C#与Flash交互

C#与Flash交互 (转自小磊在线)
C#与Flash交互
前段日子公司要求做一个C#与Flash交互的东西,用来C#与短信猫通讯将数据传到Flash上显示与操作的应用。
第一步C#添加组件
打开VS2005-工具-选择工具箱项-COM组件-选择Shockwave Flash Object-确定
添加好组件往场景上拖放,如果提示注册需求注册
c# 注册控件-在运行输 ......

C# 通过ado.net 访问oracle

1.安装ODP(oracle data provider)
2.然后在项目中引用 Oracle.DataAccess程序集
3.接着
using Oracle.DataAccess.Client;
using Oracle.DataAccess.Types;
4.然后编写程序和ado.net方位sqlserver 差别不大了,就是利用下面的对象进行编程,当然,因为oracle和sqlserver有很多地方不一样,所以细节存在很大差异。
O ......

C#处理XML

已知有一个XML文件(bookstore.xml)如下:
<?xml version="1.0" encoding="gb2312"?>
<bookstore>
  <book genre="fantasy" ISBN="2-3631-4">
    <title>Oberon's Legacy</title>
    <author>Corets, Eva</author>
  &nb ......

C#调用 win32遍历win桌面控件的算法

private static int level=0
public static int FindGUILike(ref int hWndArray,int hWndStart,ref string windowText,ref string className,ref string parentText)
{
int hwnd=0;
int r=0;
StringBuilder sWindowText=new StringBuilder();
StringBuilder sClassname=new StringBuilder();
StringBuilder sParentT ......

c# primer note I

------------------------

Foreach :
优点:
1、不用考虑数组起始索引是几
int[] nArray = new int[100];
// Use "foreach" to loop array
foreach( int i in nArray )
2、对于多维数组操作用foreach非常简便
int[,] nVisited = new int[8,8];
// Use "for" to loop two-dimension array
for( int i = 0; i ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号