System.Data.Common.ADP.InvalidStatementType(System.Data.StatementType)

Here are the examples of the csharp api class System.Data.Common.ADP.InvalidStatementType(System.Data.StatementType) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

4 Examples 7

1. Example

Project: referencesource
Source File: AdapterUtil.cs
View license
static internal InvalidOperationException UpdateConnectionRequired(StatementType statementType, bool isRowUpdatingCommand) {
            string resource;
            if (isRowUpdatingCommand) {
                resource = Res.ADP_ConnectionRequired_Clone;
            }
            else {
                switch(statementType) {
                case StatementType.Insert:
                    resource = Res.ADP_ConnectionRequired_Insert;
                    break;
                case StatementType.Update:
                    resource = Res.ADP_ConnectionRequired_Update;
                    break;
                case StatementType.Delete:
                    resource = Res.ADP_ConnectionRequired_Delete;
                    break;
                case StatementType.Batch:
                    resource = Res.ADP_ConnectionRequired_Batch;
                    goto default;
#if DEBUG
                case StatementType.Select:
                    Debug.Assert(false, "shouldn't be here");
                    goto default;
#endif
                default:
                    throw ADP.InvalidStatementType(statementType);
                }
            }
            return InvalidOperation(Res.GetString(resource));
        }

2. Example

Project: referencesource
Source File: AdapterUtil.cs
View license
static internal Exception UpdateConcurrencyViolation(StatementType statementType, int affected, int expected, DataRow[] dataRows) {
            string resource;
            switch(statementType) {
            case StatementType.Update:
                resource = Res.ADP_UpdateConcurrencyViolation_Update;
                break;
            case StatementType.Delete:
                resource = Res.ADP_UpdateConcurrencyViolation_Delete;
                break;
            case StatementType.Batch:
                resource = Res.ADP_UpdateConcurrencyViolation_Batch;
                break;
#if DEBUG
            case StatementType.Select:
            case StatementType.Insert:
                Debug.Assert(false, "should be here");
                goto default;
#endif
            default:
                throw ADP.InvalidStatementType(statementType);
            }
            DBConcurrencyException exception = new DBConcurrencyException(Res.GetString(resource, affected.ToString(CultureInfo.InvariantCulture), expected.ToString(CultureInfo.InvariantCulture)), null, dataRows);
            TraceExceptionAsReturnValue(exception);
            return exception;
        }

3. Example

Project: referencesource
Source File: AdapterUtil.cs
View license
static internal InvalidOperationException UpdateRequiresCommand(StatementType statementType, bool isRowUpdatingCommand) {
            string resource;
            if (isRowUpdatingCommand) {
                resource = Res.ADP_UpdateRequiresCommandClone;
            }
            else {
                switch(statementType) {
                case StatementType.Select:
                    resource = Res.ADP_UpdateRequiresCommandSelect;
                    break;
                case StatementType.Insert:
                    resource = Res.ADP_UpdateRequiresCommandInsert;
                    break;
                case StatementType.Update:
                    resource = Res.ADP_UpdateRequiresCommandUpdate;
                    break;
                case StatementType.Delete:
                    resource = Res.ADP_UpdateRequiresCommandDelete;
                    break;
#if DEBUG
                case StatementType.Batch:
                    Debug.Assert(false, "isRowUpdatingCommand should have been true");
                    goto default;
#endif
                default:
                    throw ADP.InvalidStatementType(statementType);
                }
            }
            return InvalidOperation(Res.GetString(resource));
        }

4. Example

Project: referencesource
Source File: AdapterUtil.cs
View license
static internal InvalidOperationException UpdateOpenConnectionRequired(StatementType statementType, bool isRowUpdatingCommand, ConnectionState state) {
            string resource;
            if (isRowUpdatingCommand) {
                resource = Res.ADP_OpenConnectionRequired_Clone;
            }
            else {
                switch(statementType) {
                case StatementType.Insert:
                    resource = Res.ADP_OpenConnectionRequired_Insert;
                    break;
                case StatementType.Update:
                    resource = Res.ADP_OpenConnectionRequired_Update;
                    break;
                case StatementType.Delete:
                    resource = Res.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(Res.GetString(resource, ADP.ConnectionStateMsg(state)));
        }