使用CreateUserWizard时,对象引用未设置为对象错误的实例
当我点击CreateUserWizard控件的“下一步”按钮时出现错误 – “对象引用未设置为对象的实例”。我检查了我的代码,我没有留下任何变量null。但我仍然可以解决这个错误。
Source Error: Line 29: object UserGUID = User.ProviderUserKey; Line 30: Line 31: DataSource.InsertParameters.Add("UserId", UserGUID.ToString()); //this is the line that caused the error Line 32: Line 33: DataSource.Insert(); This is my html code file:
我查看了我的代码,我没有留下任何变量null。 但我仍然无法解决这个错误。
您尚未检查所有变量,否则不会发生此错误。
您是否检查过您的DataSource以确保找到SqlDataSource? DataSource的InsertParameters属性确保它不为null? UserGUID确保它不为空?