If I understand you correctly, you want to update several different tables using only one function. This can be done if you are using Stored Procedures in your DataBase with a function like this:
public int ExecuteNonQuery(string connectionString, string spName, Dictionary<string,object> parameters)
{
using (SqlConnection con = new SqlConnection(connectionString))
{
SqlCommand cmdExecute = new SqlCommand(spName, con);
cmdExecute.CommandType = System.Data.CommandType.StoredProcedure;
foreach (KeyValuePair<string, object> kvp in parameters)
{
cmdExecute.Parameters.AddWithValue(kvp.Key, kvp.Value);
}
con.Open();
return cmdExecute.ExecuteNonQuery();
}
}
where spName is the name of the Stored Procedure, and the Dictionary<string,> contains your parameters, so you would call it like this:
public void Update()
{
Dictionary<string,> parameters = new Dictionary<string,>();
parameters.Add("@Param1", param1Value);
parameters.Add("@Param2", param2Value);
int rowsAffected = ExecuteNonQuery("yourConnectionString", "yourStoredProcName", parameters);
}
Hope this helps