internal static InvalidOperationException UpdateOpenConnectionRequired(StatementType statementType, bool isRowUpdatingCommand, ConnectionState state)
{
string resource;
if (isRowUpdatingCommand)
{
resource = SR.ADP_OpenConnectionRequired_Clone;
}
else
{
switch (statementType)
{
case StatementType.Insert:
resource = SR.ADP_OpenConnectionRequired_Insert;
break;
case StatementType.Update:
resource = SR.ADP_OpenConnectionRequired_Update;
break;
case StatementType.Delete:
resource = SR.ADP_OpenConnectionRequired_Delete;
break;
#if DEBUG
case StatementType.Select:
Debug.Assert(false, "shouldn't be here");
goto default;
case StatementType.Batch:
Debug.Assert(false, "isRowUpdatingCommand should have been true");
goto default;
#endif
default:
throw ADP.InvalidStatementType(statementType);
}
}
return(InvalidOperation(SR.Format(resource, ADP.ConnectionStateMsg(state))));
}