[Mono-list] npgsql and notifications

alcherenga alcherenga alcherenga at gmail.com
Fri Jan 4 06:27:32 EST 2008


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();

}

}

}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-list/attachments/20080104/3e5529cf/attachment.html 


More information about the Mono-list mailing list