Hi
I have a SQLCommand that do updates on a table.
I have a loop where I set the parameters then I call ExecuteNonQuery .
For .
{
. Set the SQLCommand's Params Values;
. SQLCommand.Exec uteNonQuery();
}
Is it possible to "cache" the SQL text sent by Calling ExecuteNonQuery () and
then execute the whole "cached SQL text" in one command ?
Something Like that :
StringBuilder Sb = new StringBuilder() ;
For.
{
. Set the SQLCommand's Params Values;
. Sb.Append(SQLCo mmand.GetExecut eNonQueryCmd() + " \n\n");
// GetExecuteNonQu eryCmd() don't exists. It's to illustrate the
principle I'm looking for.
}
SqlCommand Sc = New SqlCommand();
Sc.CommandText = Sb.Totring();
Sc.Executenonqu ery();
Thanks for your help !
Steph.
I have a SQLCommand that do updates on a table.
I have a loop where I set the parameters then I call ExecuteNonQuery .
For .
{
. Set the SQLCommand's Params Values;
. SQLCommand.Exec uteNonQuery();
}
Is it possible to "cache" the SQL text sent by Calling ExecuteNonQuery () and
then execute the whole "cached SQL text" in one command ?
Something Like that :
StringBuilder Sb = new StringBuilder() ;
For.
{
. Set the SQLCommand's Params Values;
. Sb.Append(SQLCo mmand.GetExecut eNonQueryCmd() + " \n\n");
// GetExecuteNonQu eryCmd() don't exists. It's to illustrate the
principle I'm looking for.
}
SqlCommand Sc = New SqlCommand();
Sc.CommandText = Sb.Totring();
Sc.Executenonqu ery();
Thanks for your help !
Steph.
Comment