TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Guest User
Tech Writer
2.1k
466.7k
SqlException or binary data be truncated?
Jul 22 2020 9:29 AM
Hi Team
My save functionality is getting this exception, before all my form fields were saving to my table on DB.
// Controller
public
ActionResult SubmitRegDetails(RegViewAndRoleViewModel eNtsaRegistration)
{
if
(ModelState.IsValid)
{
eNtsaRegistration.RegForm.Id = Guid.NewGuid();
db.eNtsaRegForms.Add(eNtsaRegistration.RegForm);
db.SaveChanges();
// Throws error here each time want to save changes to DB.
return
RedirectToAction(
"SaveRegForm"
);
}
// Model
public
class
eNtsaRegForm
{
[Key]
public
Guid? Id {
get
;
set
; }
public
string
Title {
get
;
set
; }
public
string
FirstName {
get
;
set
; }
public
string
LastName {
get
;
set
; }
public
string
Position {
get
;
set
; }
public
string
Company {
get
;
set
; }
public
string
StreetAddress {
get
;
set
; }
public
string
StreetAddressLine {
get
;
set
; }
public
string
City {
get
;
set
; }
public
string
StateProvince {
get
;
set
; }
public
int
ZipCode {
get
;
set
; }
public
string
Country {
get
;
set
; }
[Required(ErrorMessage =
" This field is required"
)]
[EmailAddress(ErrorMessage =
"Invalid email address"
)]
public
string
Email {
get
;
set
; }
public
int
CellNumber {
get
;
set
; }
public
string
DietaryRequirements {
get
;
set
; }
}
Reply
Answers (
7
)
I want to add ' Mark for review option ' in a Online Exam Project
Better way to handle error on web app?