I have one problem which I try to find but I still not find the way to fix it. When I run the program the message throw like below
The 'fldscr1' property on 'tblssscr' could not be set to a 'Double' value. You must set this property to a non-null value of type 'Single'.
Here is my class to run my project:
public class tblssscr
{
[Key]
public int tblssscrId { get; set; }
[DisplayName("Request code")]
public int fldssrid { get; set; }
[DisplayName("StudentId")]
public int tblss_studentId { get; set; }
public virtual tblss_student tblss_student { get; set; }
[DisplayName("Student Tempcode")]
public string fldstdtmpcode { get; set; }
[DisplayName("Attandence")]
public int fldatt { get; set; }
[DisplayName("Discount (%)")]
public int flddiscount { get; set; }
[Required(ErrorMessage = "Score 1 is required!")]
[DisplayName("Score 1")]
public float? fldscr1 { get; set; }
[DisplayName("Score 2")]
public float fldscr2 { get; set; }
[DisplayName("Total Score")]
public float fldtscr { get; set; }
[DisplayName("Offer Code")]
public int fldrst { get; set; }
}
If you want to store a double in fldscr1
set it to a double like this
[Required(ErrorMessage = "Score 1 is required!")]
[DisplayName("Score 1")]
public double fldscr1 { get; set; }
Change this line:
[DisplayName("Score 1")]
public float? fldscr1 { get; set; }
To:
[DisplayName("Score 1")]
public float fldscr1 { get; set; }
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.