On 1/16/08, Database Team <[EMAIL PROTECTED]> wrote:
> How to handle the Firebird Event notification from my .NET Application.
> I want to know what changes are made to the Database Tables.

Hello, here is example of processing events:
static void Main(string[] args)
{
        FbConnectionStringBuilder cs = new FbConnectionStringBuilder();
        cs.DataSource   = "localhost";
        cs.Database             = "employee.fdb";
        cs.UserID               = "SYSDBA";
        cs.Password             = "masterkey";
        cs.Charset              = "NONE";
        cs.Pooling              = false;

        FbConnection connection = new FbConnection(cs.ToString());
        connection.Open();

        FbRemoteEvent revent = new FbRemoteEvent(connection);
        revent.AddEvents(new string[] { "new_order" });

        // Add callback to the Firebird events
        revent.RemoteEventCounts += new FbRemoteEventEventHandler(EventCounts);

        // Queue events
        revent.QueueEvents();

        string sql = "INSERT INTO SALES (PO_NUMBER, CUST_NO, SALES_REP,
ORDER_STATUS, " +
                                        "ORDER_DATE, SHIP_DATE, DATE_NEEDED, 
PAID, QTY_ORDERED, TOTAL_VALUE, " +
                                        "DISCOUNT, ITEM_TYPE) VALUES 
(@po_number, 1004, 11, 'new', " +
                                        "'1991-03-04 00:00:00', '1991-03-05 
00:00:00', NULL, 'y', 10, 5000, " +
                                        "0.100000001490116, 'hardware');";

        FbCommand command = new FbCommand(sql, connection);

        command.Parameters.Add("@po_number", FbDbType.Char, 8);

        for (int i = 360; i < 365; i++)
        {
                command.Parameters[0].Value = "V91E0" + i.ToString();
                command.ExecuteNonQuery();
        }

        System.Threading.Thread.Sleep(2000);

        connection.Close();
}

static void EventCounts(object sender, FbRemoteEventEventArgs args)
{
        Console.WriteLine("Event {0} has {1} counts.", args.Name, args.Counts);
}

-- 
Jiri {x2} Cincura (Microsoft Student Partner)
http://blog.vyvojar.cz/jirka/ | http://www.ID3renamer.com

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Firebird-net-provider mailing list
Firebird-net-provider@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider

Reply via email to