我想在 oracle 中使用带有 OracleParameter 的“全部插入”语句。我必须仅在一次执行中插入可变编号行。我怎样才能做到这一点?这里有一些代码:
string queryInsertRecipients = "INSERT INTO YS_ES_TO(EMAILID,EMAILTO) VALUES(:pEMAILID,:pEMAILTO)";
OracleConnection connection = OracleConnectionOpen("csEmailManagement");
OracleCommand command = new OracleCommand();
OracleParameter[] toParameters = new OracleParameter[2];
for (int i = 0; i < emailMessageList.Length; i++)
{
toParameters[0] = command.Parameters.Add("pEMAILID", OracleDbType.Int32, emailId, ParameterDirection.Input);
toParameters[1] = command.Parameters.Add("pEMAILTO", OracleDbType.Varchar2, emailMessageList[i], ParameterDirection.Input);
command.CommandText = queryInsertRecipients;
command.Connection = connection;
}