私はvb.netNotificationで与えられたイベントを利用しようとしています。Npgsql私はこのメカニズムについて部分的に考えました。私が学んだことは、特定のテーブルのデータが変更されると、そのデータがtrigger起動されるので、内部でフロントエンドtriggerにアクセスできるということでした。notifydata change
私はフロントエンドでこの次のコードを実行することができました
Public Sub test()
Dim conn = New NpgsqlConnection("Server=servername;port=portNo; _
User Id=UID;pwd=PWD;DataBase=DB;")
conn.Open()
Dim command = New NpgsqlCommand("listen notifytest;", conn)
command.ExecuteNonQuery()
AddHandler conn.Notification, AddressOf NotificationSupportHelper
command = New NpgsqlCommand("notify notifytest;", conn)
command.ExecuteNonQuery()
End Sub
Private Sub NotificationSupportHelper(ByVal sender As Object, _
ByVal e As NpgsqlNotificationEventArgs)
'Notified here.
End Sub
上記のコードは問題なく動作しています。しかし、私が知りたいのは、フロントエンドのデータがフロントエンドに変更され、その結果、フロントエンドが起動されるようにする方法を作成する方法ですtrigger。どこに電話する必要がありますか。各クエリの実行を呼び出す必要がありますか?誰かが私の疑問をいくつかのサンプルコードで明らかにすることができますか?notifiesNotification eventlistenlisten