none
SqlDependency column-specific Subscription RRS feed

  • Question

  • Hi !

    We recently implemented an updating feature with SQLDependency.
    Now I found out that explicitly specifiying the columns does  not 
    restrict the conditions under which the Notification is fired.
    I specify only 1 columns of a table but get notifications if I do
    updates in any of the other columns (on existing records).

    My Code:

               string str = "Data Source=localhost;Initial Catalog=Northwind;User Id=myuser";
                using (SqlConnection conn = new SqlConnection(str))
                {
                    conn.Open();
                    SqlDependency.Start(str);
                    SqlCommand cmd = new SqlCommand("Select Phone from dbo.Customer", conn);
                    SqlDependency sqlDependency = new SqlDependency(cmd);
                    sqlDependency.OnChange += new OnChangeEventHandler(sqlDependency_OnChange);
                    cmd.ExecuteNonQuery();

                }

    Does anybody know about this bug , or is this a feature ?

    Sigi


    Wednesday, October 24, 2007 3:18 PM