时间匹配时如何检索记录 [英] How to retrive records when time is matching

查看:107
本文介绍了时间匹配时如何检索记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我有一个名为Tickets的数据库表.某些第三方应用程序将记录填充到表中(因此我无法控制它).票证表具有以下列
票证编号,日期,开始时间,结束时间.


现在,我已经用C#编写了Windows服务.当日期和开始时间将使用C#匹配时,我想从表中收集记录.

我不想编写每2分钟执行一次的查询,并检查匹配记录.我也尝试使用Sql Dependancy,但是找不到解决方案.我想我也不能写预定的作业,因为票的StartTime每次都不一样.其他日子可能会有所不同.

我想要高效的解决方案,它需要更少的数据库连接查询执行次数.

谢谢,
bipin

Hi,
I have database table called Tickets. Records are populated into the table by some third party application (So i don''t have control over it). Ticket table has following columns
TicketNumber, Date, StartTime, EndTime.


Now I have written windows service in C#. I want to collect records from table when Date and StartTime will match using C#.

I don''t want to write a query which will be executed after every 2 min, and will check for match record. I also tried to use Sql Dependancy but couldn''t find the solution. I think I also can''t write scheduled job because StartTime of the ticket is not same every time. It could be different for other days.

I want efficient solution which will need less number of times Database Connections or Query Execution.

Thanks,
bipin

推荐答案

编写SSIS软件包是解决此问题的理想方法.顺便说一句,Sql Server 2005中的SSIS需要VB.Net,但这不应该成为问题-VB与C#相同,只是不同.
Writing a SSIS package is the perfect solution for this. BTW, SSIS in Sql Server 2005 requires VB.Net, but that shouldn''t be a problem - VB is the same as C#, only different.


嗨.您可以尝试使用查询通知或数据库触发器.有关 http://stackoverflow的详细信息.com/questions/1559581/how-to-notify-a-windows-servicec-of-a-db-table-changesql-2005 [
Hi. You can try to use query notifications or database triggers. More info on http://stackoverflow.com/questions/1559581/how-to-notify-a-windows-servicec-of-a-db-table-changesql-2005[^]


这篇关于时间匹配时如何检索记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆