简体   繁体   English

当在 sql server 表中插入特定值时,如何在 C# 中运行事件..?

[英]How to run an event in C# when a Particular value is inserted in sql server table..?

I have a live application logging some values from a device @ the rate of one insertion per second.我有一个实时应用程序从设备记录一些值@每秒一次插入的速率。

Now my problem is i want to get notified in my UI when value inserted in table goes out of a range...现在我的问题是我想在表中插入的值超出范围时在我的 UI 中得到通知......

I don't Know how to implement this... Please help with which technique to use... is it trigger or CLR trigger or any other way....??我不知道如何实现这个......请帮助使用哪种技术......它是触发器还是CLR触发器或任何其他方式......??

You could probably use a timer to verify the newly inserted values, or, if you want to use a trigger, print some information and use SqlConnection.InfoMessage event.您可能可以使用计时器来验证新插入的值,或者,如果您想使用触发器,请打印一些信息并使用SqlConnection.InfoMessage事件。 In your event handler query the table for new values.在您的事件处理程序中查询表以获取新值。 Be aware that the second option would require a permanently opened connection which may be an issue.请注意,第二个选项需要永久打开的连接,这可能是一个问题。

You can try SQL server notification service.您可以尝试 SQL 服务器通知服务。 http://technet.microsoft.com/en-us/library/cc966501.aspx http://technet.microsoft.com/en-us/library/cc966501.aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 将值插入 C# 中的 SQL 服务器表后,如何将值加 1? - How do I add 1 to a value after it's inserted into SQL Server table in C#? C#:当插入到 DateTimeOffset SQL 服务器列时,如何停止将时区偏移添加到 System.DateTime - C# : how to stop timezone offset being added to System.DateTime when inserted into a DateTimeOffset SQL Server column 没有错误,但仍未使用ASP.NET和C#将数据插入SQL Server表中 - No errors but still data not inserted to SQL Server table using ASP.NET with C# 与本地字符串值c#比较后如何在sql server表中存储值 - how to store value in sql server table after comparing with local string value c# SQL 服务器和 C#:获取最后插入的 id - SQL Server and C#: get last inserted id C# ExecuteScalar() 返回 null 但数据插入到 SQL 表中 - C# ExecuteScalar() returns null but the data is inserted in the SQL table C#如何在插入SQL Server数据库后立即读取数据? - C# How do I read data from an SQL Server database as soon as it is inserted? 如何在C#Windows Form应用程序中获取SQL Server中今天插入的数据的记录 - How to get record of today's inserted data in SQL Server in C# windows form application 获取SQL Server和C#中最后插入的字符串ID - Get the last inserted string Id in SQL Server & C# C#+ SQL Server ExecuteScalar()没有返回最后插入的id - C# + SQL Server ExecuteScalar() not returning last inserted id
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM