Learn about MVC every day [Verification Mode update table Error]

Source: Internet
Author: User

My problems are based on ASP. NET mvc2.0. I have not tested these problems for the moment.

Http://msdn.microsoft.com/zh-cn/downloads/ff393634

Read this articleArticleVery good. The Verification Mode updates the content of the form. The verification is successful first, then submitted to the server, and then the server is verified, which is much more secure,ProgramFlexible and convenient for secondary development. As long as you change the verification rules in the model, the verification rules for the entire site are released.

Assume that the authentication mode of this person is for a table like this in the database.

Create Table

 

Create Table [ DBO ] . [ T_person ] (
[ Userid ] [ Int ] Not Null Identity ( 1000 , 1 ),
[ Firstname ] [ Nvarchar ] ( 50 ) Null ,
[ Lastname ] [ Nvarchar ] ( 50 ) Null ,
[ Age ] [ Int ] Null ,
[ Email ] [ Nvarchar ] ( 50 ) Null

Constraint [ Pk_t_person ] Primary Key Clustered
(
[ Userid ] ASC
) With (Pad_index = Off , Statistics_norecompute = Off , Ignore_dup_key = Off , Allow_row_locks = On , Allow_page_locks = On ) On [ Primary ]
) On [ Primary ]

 

If an error occurs while updating the t_person table using the model person data, the update fails.

The reason is: You 'd better design the person, add the userid, and associate the person with the t_person based on the primary key, and then perform the update operation.

 

Note the following:

If your t_person table has only six fields, and you have set several more fields in person, and then insert the required values into the t_person table, an error will be reported during the update.

The solution is to be diligent and recreate a model to add as many fields as possible in the expected table.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.