[Mono-list] npgsql and notifications
Dewan Hrishikesh
hrishikesh.dewan at gmail.com
Fri Jan 4 09:19:21 EST 2008
just replace the command string with listen and notify. for more, pl look on
to pgsql manula for listen and notify.
On Jan 4, 2008 4:57 PM, alcherenga alcherenga <alcherenga at gmail.com> wrote:
> hi,
> i wrote a small code to see the notificationsevent handler in npgsql but
> the code seems to be not working at all - in that it is not
> receiving/displaying any notifications. i have pasted the code here, could
> n't ascertain where it's going wrong
>
> using
> System;
>
>
>
> using
> System.Data;
>
> using
> Npgsql;
>
> using
> NpgsqlTypes;
>
> namespace
> ConsoleApplication1
>
> {
>
> class Program
>
> {
>
> static void con_Notification(object sender, NpgsqlNotificationEventArgs e)
>
>
> {
>
> Console.WriteLine("Notification received");
>
> Console.WriteLine(e.Condition);
>
> }
>
> static void Main(string[] args)
>
> {
>
> string connection_string;
>
> connection_string =
> "Server=127.0.0.1
> ;Database=rss_reader;username=postgres;password=password;SyncNotification=true";
>
> NpgsqlConnection con = new NpgsqlConnection (connection_string);
>
> try
>
> {
>
> con.Open();
>
> NpgsqlCommand cmd = new NpgsqlCommand ("notify notifytest;", con);
>
> cmd.ExecuteNonQuery();
>
> con.Notification +=
> new NotificationEventHandler(con_Notification);
>
> cmd =
> new NpgsqlCommand(";" , con);
>
> cmd.ExecuteNonQuery();
>
>
>
> }
>
> catch (Exception e)
>
> {
>
> Console.WriteLine(e.Message);
>
> }
>
> Console.WriteLine("reached here");
>
> Console.ReadLine();
>
> con.Close();
>
> }
>
> }
>
> }
>
>
>
> _______________________________________________
> Mono-list maillist - Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
>
>
--
"Reality leaves a lot to the imagination."
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-list/attachments/20080104/81a962da/attachment.html
More information about the Mono-list
mailing list