sqldependency

Unstable application uses SqlDependency. Several states and errors

我的未来我决定 提交于 2019-12-11 18:59:22
问题 I have a windows application using SqlDependency running at separated thread pool, this application represents a log monitor UI get the latest rows added in a specific table in the database and view it in a DataGridView. You can see the application source code from this LINK, or follow this script. const string tableName = "OutgoingLog"; const string statusMessage = "{0} changes have occurred."; int changeCount = 0; private static DataSet dataToWatch = null; private static SqlConnection

SQL dependency and data refering in SQL

我是研究僧i 提交于 2019-12-11 12:29:10
问题 when we work with sql dependency then we need to always refer a sql like below one SELECT ActivityDate FROM [bba-reman].MyLog i just like to know if i write the above sql this way then does it work SELECT TOP 1 ActivityDate FROM [bba-reman].MyLog OR SELECT TOP 5 ActivityDate FROM [bba-reman].MyLog i am looking for suggestion and guidance. private void RegisterNotification() { string tmpdata = ""; System.Data.SqlClient.SqlDependency.Stop(connectionString); System.Data.SqlClient.SqlDependency

SqlDependency doesn't fire on row insertion (or update, or delete)

老子叫甜甜 提交于 2019-12-11 11:36:25
问题 After bashing my head against a wall for the next few hours I've slowly started to realise where my problem lays, so let me give you a recap: I'm trying to change a website's string when a row gets inserted into a database, but for some reason the trigger I've made that tells me when there's been a change into the database doesn't fire at all when an insertion, udpate or whatever happens. The table's Service Broker is on. This is the involved code: namespace WebApplication.SignalR_Data {

NHibernate SysCache2 - dependency breaks cache

岁酱吖の 提交于 2019-12-11 11:08:04
问题 Company class: class Company { public virtual int Id { get;set;} public virtual string Name { get;set;} public virtual int IntProp { get;set;} } Companies table: CREATE TABLE Companies ( Id INT PRIMARY KEY, Name NVARCHAR(50) NOT NULL, IntProp INT NULL ); Here is my web.config: <syscache2> <cacheRegion name="RefData"></cacheRegion> <cacheRegion name="Company"> <dependencies> <commands> <add name="CompanyCommand" command="SELECT * FROM Companies WHERE Deleted = 0" /> </commands> </dependencies>

Route To Take With SqlDependency OnChange

别等时光非礼了梦想. 提交于 2019-12-11 08:05:01
问题 I am trying to integrate live updates in my ASP.NET WebAPI and I have hit a wall so to say. I have my application set up (using Angular on front end), and I've got it so when the page initially loads it issues a get request from my SQL database and the web page loads with this data. This data changes pretty frequently, and I want to incorporate live updates. I have my back end set up to use a SqlDependency to notify me when a change in the database occurs, but where to go from here I have no

Windows Application SqlDepedency Calling Onchange infinitely

99封情书 提交于 2019-12-11 07:56:55
问题 I have console application in which I am doing sqldependency. My problem is when I set commandType as Text, it is working fine. But if I use commandType as StoredProcedure, onchange method is calling infinitely. Please see the code below: static DataSet myDataSet; static SqlConnection connection; static SqlCommand command; static void Main(string[] args) { // Remove any existing dependency connection, then create a new one. string connstr = "Data Source=XYZ;Initial Catalog=Dev;Integrated

SqlDependency doesn't fire OnChange event when dataset is changed

烈酒焚心 提交于 2019-12-11 06:39:56
问题 I'm new to the concept of query notifications with SQL Server and it's going to take some time for me to wrap my head around it. My objective is to create a Windows service application that is notified when a change has been made to a SQL Server table. I followed this guide which was helpful in getting me started. However I'm not able to get the expected result. The OnStart() method in my windows service app looks like so: protected override void OnStart(string[] args) { eventLog1.WriteEntry(

SignalR and SqlDependency refreshment issue - ASP.NET

≡放荡痞女 提交于 2019-12-11 03:47:54
问题 I have a table in MSSQL database, and I have an ASPX page, I need to push all new rows to the page in a descending order. I found this awesome tutorial which is using SignalR and SqlDependency and it shows only the last row descarding the previous rows which have been added when I'm online, it does that because it has a span element to show data and every time it overwrites this span, so I modified the JavaScript code to append the new data and it works fine. The problem now is when I

Instantiate SignalR Hub Object With IHubContext

守給你的承諾、 提交于 2019-12-10 23:25:35
问题 It seems like a big use for SignalR Hubs is to display the actions of one client to all of the other clients. What I hope to use SignalR for is when a certain event happens in my server side code, I want to instantiate a hub object and invoke one of its methods to communicate with all of the clients. If you see my previous post (Route To Take With SqlDependency OnChange), I would like to do this in the OnChange method of SqlDependency. Upon researching it I have found some people talk about

SQLDependency thread

China☆狼群 提交于 2019-12-10 20:36:46
问题 i am in the process implementing SQLdepenency i would like to know in case of Dependency Handler exeuctues will it spun a different thred from main Process ? What will happen when the event handler triggers? Do i need to worry about any multithreds issues? public void CreateSqlDependency() { try { using (SqlConnection connection = (SqlConnection)DBFactory.GetDBFactoryConnection(Constants.SQL_PROVIDER_NAME)) { SqlCommand command = (SqlCommand)DBFactory.GetCommand(Constants.SQL_PROVIDER_NAME);