使用 ASP.NET MVC 2、实体框架、MySQL、VS2010 Ultimate。我已经研究了很长时间,但对我的代码中的一般输入异常命中没有线索。虽然我已经删除了所有 where 子句:
var record = (from staff in pmsEntities.ef_staff
select staff
).FirstOrDefault();
[FormatException:输入字符串的格式不正确。]
System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) +9594283 System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) +119 System.String.System.IConvertible.ToInt32(IFormatProvider provider) +46 System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider) +385 MySql.Data.Entity.EFMySqlDataReader.ChangeType(Object sourceValue, Type targetType) +566 MySql.Data.Entity.EFMySqlDataReader.GetValue(Int32 ordinal) +231 System.Data.Common.Internal.Materialization.ErrorHandlingValueReader`1.GetValue(DbDataReader reader, Int32 ordinal) +215 System.Data.Common.Internal.Materialization.Shaper.GetPropertyValueWithErrorHandling(Int32 ordinal, String propertyName, String typeName) +68 lambda_method(Closure , Shaper ) +1088 System.Data.Common.Internal.Materialization.Shaper.HandleEntityAppendOnly(Func`2 constructEntityDelegate, EntityKey entityKey, EntitySet entitySet) +218 lambda_method(Closure , Shaper ) +291 System.Data.Common.Internal.Materialization.Coordinator`1.ReadNextElement(Shaper shaper) +170 System.Data.Common.Internal.Materialization.SimpleEnumerator.MoveNext() +84 System.Linq.Enumerable.FirstOrDefault(IEnumerable`1 source) +4187840 System.Data.Objects.ELinq.ObjectQueryProvider.<GetElementFunction>b__1(IEnumerable`1 sequence) +41 System.Data.Objects.ELinq.ObjectQueryProvider.ExecuteSingle(IEnumerable`1 query, Expression queryRoot) +59 System.Data.Objects.ELinq.ObjectQueryProvider.System.Linq.IQueryProvider.Execute(Expression expression) +150 System.Linq.Queryable.FirstOrDefault(IQueryable`1 source) +265 IDP.Models.Login.IsValid(String _username, String _pwd, Int32 _type) in C:\Users\george\Desktop\Um\idp\nur\IDP\IDP\Models\Login.cs:36