1
Vote

Invalid value 0 for state

description

I have about 50 DL classes all based on the same pattern. In 2 of the 50 or so classes when I attempt to an Insert I get the error:
 
"Invalid value 0 for state. Valid Range is from 1 to 127."
 
Here the code:
 
 
            Database db = DatabaseFactory.CreateDatabase("main");
            SqlCommand command = (SqlCommand)db.GetStoredProcCommand("asp_DutyHoursInsert");
            db = GetParameters(dutyHours, db, command, true);
            db.ExecuteNonQuery(command);
            dutyHours.DutyHoursID = (int)db.GetParameterValue(command, "@DutyHoursID");
            dutyHours.IsDirty = false;
            return dutyHours;
 
The exception occurrs on the ExecuteNonQuery() function. DutyHourID is a SQL Server database generated Identity Key.
 
Any ideas? Thanks.

comments