2011年9月6日

SqlDependency介绍

SqlServer的查询通知
1、SqlDependency对象是和SqlServer 2005以上的一个查询通知依赖关系;SqlDependency通过注册一个事件,来接收SqlServer的通知消息。
2、SQl的 Service Broker:是一个事件消息传递机制,是事务的一部分。
3、依赖的查询有要求。
如:不能用select * from...;只能查数据表
"select Style,PhoneNum,FileName,Flag from [dbo].[TFax]" 
"select Style,PhoneNum,FileName,Flag from [dbo].[TFax] where Style= 1 and State =0"
只要数据库中满足该Sql语句的数据发生更新,即可触发消息通知。
_cmd = new SqlCommand(sql, conn);
SqlDependency _sqlDependency = new SqlDependency(_cmd );                   //设置通知   
_sqlDependency .OnChange += new OnChangeEventHandler(sqlDependency_OnChange); //通知事件   
_sqlDependency = new SqlDependency(_cmd);

posted @ 2011-09-06 08:35 cn罗克 阅读(49) 评论(0) 编辑

2011年3月3日

SQl server Service Broker

Enabling Service Broker

The following T-Sql enables or disabled service broker on SqlServer 2005. The Service Broker is required by .net for SqlCacheDependency support

-- Enable Service Broker: ALTER DATABASE [Database Name] SET ENABLE_BROKER;  -- Disable Service Broker: ALTER DATABASE [Database Name] SET DISABLE_BROKER; 

Is Service Broker enabled?

To determine whether or not Service Broker is enabled for a particular database, execute the following T-SQL

SELECT is_broker_enabled FROM sys.databases WHERE name = 'Database name'; -- Where 'Database name' is the name of the database you want to query. 

is_broker_enabled will be 1 if Service Broker is enabled for the given database, otherwise it'll be 0.

posted @ 2011-03-03 09:37 cn罗克 阅读(60) 评论(0) 编辑

2010年12月23日

两种WPF Toolkit Chart LegendStyle

使用WPF数据可视化组件时候需要定义chart的图例风格:

下面从网上找来的,经过调整可以直接使用:

需要添加以下引用: 

}System.Windows.Controls.DataVisualization.Toolkit.dll
}xmlns:chartingToolkit="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit

}或者xmlns:chartingTookit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit" 

 1、 不显示Title和Legend的自定义Style

 

 定义:

<Style x:Key="LegendStyle2" TargetType="Control">
        
<Setter Property="Template">
            
<Setter.Value>
                
<ControlTemplate TargetType="chartingToolkit:Chart">
                    
<!--<Border Background="{TemplateBinding Background}"
                        BorderBrush="{TemplateBinding BorderBrush}"
                        BorderThickness="{TemplateBinding BorderThickness}"
                        Padding="10">
-->
                        
<Grid>
                            
<Grid.RowDefinitions>
                                
<RowDefinition Height="Auto"/>
                                
<RowDefinition Height="*"/>
                            
</Grid.RowDefinitions>
                            
<!--<datavis:Title Style="{TemplateBinding TitleStyle}" Content="{TemplateBinding Title}" />-->
                            
<Grid Margin="0,15,0,15" Grid.Row="1">
                                
<Grid.ColumnDefinitions>
                                    
<ColumnDefinition Width="*" />
                                    
<ColumnDefinition Width="Auto" />
                                
</Grid.ColumnDefinitions>
                                    
<!--<datavis:Legend x:Name="Legend"
                                               Style="{TemplateBinding LegendStyle}"
                                               Grid.Column="1"
                                               Title="{TemplateBinding LegendTitle}" />
-->
                                    
<chartingprimitives:EdgePanel x:Name="ChartArea" Style="{TemplateBinding ChartAreaStyle}">
                                    
<Grid Style="{TemplateBinding PlotAreaStyle}" Canvas.ZIndex="-1" />
                                    
<!-- I removed the border-->
                                    
<!--<Border Canvas.ZIndex="10" BorderBrush="#FF919191" BorderThickness="1" />-->
                                    
</chartingprimitives:EdgePanel>
                            
</Grid>
                        
</Grid>
                    
<!--</Border>-->
                
</ControlTemplate>
            
</Setter.Value>
            
</Setter>

        </Style> 

 使用:

         <chartingToolkit:Chart DataContext="1,10 2,20 3,30 4,40" Name="chart1" Title="趋势图" Style="{StaticResource LegendStyle2}" >

            <chartingToolkit:LineSeries DependentValuePath="X" IndependentValuePath="Y"/>
        
</chartingToolkit:Chart>

 

 

posted @ 2010-12-23 19:15 cn罗克 阅读(618) 评论(0) 编辑

2010年12月14日

WPF动态创建元素

由于项目的需要,现在要实现动态添加、布局WPF控件的功能;现在开始边学习,边记录了。

资源篇:

http://www.cnblogs.com/chenxizhang/archive/2010/03/25/1694899.html 

2、WPF使用代码进行绑定

 http://www.dotnetdev.cn/2010/02/wpf%E4%BD%BF%E7%94%A8%E4%BB%A3%E7%A0%81%E8%BF%9B%E8%A1%8C%E7%BB%91%E5%AE%9A/

 

 

posted @ 2010-12-14 18:13 cn罗克 阅读(94) 评论(0) 编辑

c#接收邮件类

http://blog.csdn.net/qdzx2008/archive/2006/11/13/1381836.aspx

利用POP3协议来管理自己的邮箱 

http://yw7788.blog.hexun.com/18218236_d.html 

posted @ 2010-12-14 09:06 cn罗克 阅读(84) 评论(0) 编辑

2010年11月15日

SQL字符串分拆

摘要: 字符串分拆?--各种字符串分函数if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[f_splitSTR]') and xtype in (N'FN', N'IF', N'TF'))drop function [dbo].[f_splitSTR]GO--3.2.1 循环截取法CREATE FUNCTION f_...阅读全文

posted @ 2010-11-15 14:20 cn罗克 阅读(55) 评论(0) 编辑

2010年10月14日

c# word转tif

摘要: 预备工作:完整安装office 2003,然后添加COM组件引用,Microsoft WORD 11.0 在打印机和传真机选项中将Microsoft Office Document Image Writer设为默认打印机 需添加的命名空间:using Microsoft.Office.Interop.Word; using System.IO; class PrintDocToTif ...{ s...阅读全文

posted @ 2010-10-14 09:30 cn罗克 阅读(271) 评论(0) 编辑

2009年6月8日

Exception from HRESULT: 0x800736B1 

摘要: c#调用C++动态库出现的错误,找到这个地址的解决方案,暂时记下来,回去试验,有结果再来反馈http://dearymz.blog.163.com/blog/static/2056574200821111952160/ http://objectmix.com/dotnet/104166-hresult-0x800736b1.htmlhttp://www.tech-archive.net/Arch...阅读全文

posted @ 2009-06-08 16:10 cn罗克 阅读(1197) 评论(0) 编辑

2009年1月2日

visual studio .net 2003 不停重启错误

摘要: 今天好郁闷,早上启动vs2003.net就报错误,要求重启,重启vs2003后问题依旧,还是报错,郁闷。。。google下解决方案,竟然是要重装操作系统,My God!难道就要我这么缴械不成,我要抗争!第一套方案:代价最低的开始,修复Vs2003,最终以失败告终期间也想着是不是前天安装的svn server引起的,也卸了svn server第二套:卸载,重装Vs2003。。。。。。还是惨败!!!真...阅读全文

posted @ 2009-01-02 17:12 cn罗克 阅读(595) 评论(2) 编辑

2008年12月7日

作为一个合格程序员每天该做的事【转文】

摘要: 来自:http://www.jpinw.com/teach/cn/200712/1209660.html作者:佚名教程来源:不详点击数: 更新时间:2007-12-26作为一个合格程序员每天该做的事。 1、总结自己一天任务的完成情况最好的方式是写工作日志,把自己今天完成了什么事情,遇见了什么问题都记录下来,日后翻看好处多多2、考虑自己明天应该做的主要工作把明天要做的事情列出来,并按照优先级排列,第...阅读全文

posted @ 2008-12-07 22:12 cn罗克 阅读(69) 评论(1) 编辑

导航

<2012年2月>
2930311234
567891011
12131415161718
19202122232425
26272829123
45678910

公告

跟小D每日学口语
昵称:cn罗克
园龄:4年8个月
粉丝:0
关注:0

搜索

 
 

常用链接

最新随笔

我的标签

随笔档案(18)

文章分类

常用链接

积分与排名

  • 积分 - 13587
  • 排名 - 6968

最新评论

阅读排行榜

评论排行榜

推荐排行榜