Patrick,
Using the CommandBuilder is more of a crutch than anything else. It's a bad idea, IMHO.
Whether you generate the SQL commands yourself, or you use a Stored Proc, your best bet is to have a generic method to auto-generate this stuff for you. Basically, it would just iterate through the columns in your table and generate either a SQL command text or Parameters to use in your Stored Proc call. Maybe something like this for generating SP parms, just to give you an idea and get you started:
public void SetParameters(SqlCommand sc, DataTable dt, DataRow row, string PKName)
{
sc.Parameters.Clear();
for (int i=0; i < dt.Columns.Count; i++)
{
if (row[i] != DBNull.Value)
sc.Parameters.Add("@" + dt.Columns[i].ColumnName, row[i]);
}
sc.Parameters["@" + PKName].Direction = ParameterDirection.InputOutput;
}
Hope this helps ...
~~Bonnie
>Hi to everybody
>The restriction of the command builder of working only for Selects without join is for me a no go. Building all update etc commands each time on foot as well.
>
>Did anybody build something to retrieve the CommandText of the SQL Object and to build the other command objects in a more intelligent way than the command builder does?