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  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-list

Reply via email to