I'm trying to figure out how to update multiple rows in my Directory table, when a user changes their Street Number or Street Name in their profile. They can add multiple users to a directory and each user they add to the directory has this primary users UserId in it. So if the primary user changes their address, I want it to update the address for all the users they listed in the directory as well. I'm adding this to the On_Click in the Code Behind, so when they click to update their profile, it fires this function as well.
This code may be way off, but here's what I have right now:
//Update directory user addresses for this account, if profile address has changed
if ((currentStreetNumber != creatingStreetNumber) || (currentStreetName != creatingStreetName))
string myDirectoryConnection = WebConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
SqlDataAdapter cmd2 = new SqlDataAdapter("Update Directory SET [StreetNumber] = @StreetNumber, [StreetName = @StreetName] WHERE [UserId] = @UserId", myDirectoryConnection);
View Complete Post