The field type is money, if I put a '0' or a '1' in the field I get this error:
System.Reflection.TargetInvocationException:
Exception has been thrown by the target of an invocation. --->
System.InvalidCastException: Specified cast is not valid.
at System.Data.SQLite.SQLiteDataReader.VerifyType(Int32 i, DbType typ)
at System.Data.SQLite.SQLiteDataReader.GetBoolean(Int32 i)
--- End of inner exception stack trace ---
This is from the model designer:
<Property Name="Amount" Type="decimal" Precision="53" />
====
<EdmScalarPropertyAttribute(EntityKeyProperty:=False, IsNullable:=True)>
<DataMemberAttribute()>
Public Property Amount() As Nullable(Of Global.System.Decimal)
Get
Return _Amount
End Get
Set(ByVal value As Nullable(Of Global.System.Decimal))
OnAmountChanging(Value)
ReportPropertyChanging("Amount")
_Amount = StructuralObject.SetValidValue(value)
ReportPropertyChanged("Amount")
OnAmountChanged()
End Set
End Property
Private _Amount As Nullable(Of Global.System.Decimal)
Private Partial Sub OnAmountChanging(value As Nullable(Of Global.System.Decimal))
End Sub
Private Partial Sub OnAmountChanged()
End Sub
Code to get error:
Dim Query = From c In EnData.Transactions Where c.TranID = 660 ' this tran is the amount 0
For Each tran In Query 'Error here
Next
I Got the problem... its not the amount field. an other column which is a bit type, some times it doesn't like the way I wrote the false or true. that causes the problem.
The solution is to use 1 for true and 0 for false, that is always ok.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With