2013-04-04 53 views
1

我studiyng這個MvcMovie教程和我正在做一些改變.....註冊爲用戶失敗... Asp.net MVC實體框架

Initialy,我已經2類從的DbContext,一個衍生電影和其他用戶...

所以我把它們轉移到一個單一的DbContext ....

public class MovieDBContext : DbContext 
{ 
    public DbSet<Movie> Movies { get; set; } 
    public DbSet<UserProfile> UserProfiles { get; set; } 


} 

但現在,當我嘗試自己註冊爲用戶,我在這條線的AccountController

的出現錯誤
WebSecurity.CreateUserAndAccount(model.UserName, model.Password); 

錯誤是這個:

Cannot insert the value NULL into column 'xxx', table 'aspnet-MvcMovie-20120730162622.dbo.UserProfile'; column does not allow nulls. INSERT fails. 

我不明白什麼是XXX,我在數據庫看,我發現這個名字沒有列...我只找到XXX在我的jQuery的文件,像這樣

/* Handles responses to an ajax request: 


* - sets all responseXXX fields accordingly 
* - finds the right dataType (mediates between content-type and expected dataType) 
* - returns the corresponding response 
*/ 

我不知道那是什麼..我沒有研究的jQuery但....我不知道這是否是我的問題的一部分,或者它有什麼關係呢?

+0

我不認爲它與jQuery有什麼關係。如果您對UserProfile模型進行了更改,則需要將這些更改反映到數據庫中。您可以發佈完整的註冊控制器操作以及您的UserProfile模型。 – MattSull 2013-04-04 08:47:20

回答