2

我有以下问题。我想在 ASP 中将自定义字段添加到我的注册数据中。我已经通过以下方式做到了这一点。

 Protected Sub CreateUserWizard1_CreatedUser(ByVal sender As Object, ByVal e As       System.EventArgs) Handles CreateUserWizard1.CreatedUser
    ' create an empty profile
    Dim p As ProfileCommon = ProfileCommon.Create(CreateUserWizard1.UserName, True)



    ' fill profile with values from CreateUserStep
    p.LastName = CType(CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("txtLastName"), TextBox).Text

    p.Name = CType(CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("txtName"), TextBox).Text

    p.BirthDate = CType(CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("txtBirthDate"), TextBox).Text

    p.PostCode = CType(CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("txtPostCode"), TextBox).Text

    p.RegNr = CType(CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("txtRegNr"), TextBox).Text


    MsgBox(p.LastName)
    MsgBox(p.Name)
    MsgBox(p.BirthDate)
    MsgBox(p.PostCode)
    MsgBox(p.RegNr)

    ' save profile
    p.Save()
End Sub

我还在 de web.config 文件中创建了正确的属性。当我在 msgboxes 中捕获数据时,它会显示正确的数据。

但是我在数据库中的表没有填满。只填写默认的用户名、密码等。我在我的 aspnet_profile 表中创建了新字段。但什么也没有发生。

有谁知道这个问题的原因是什么?为什么我的个人资料信息不存储在数据库中。

提前致谢!

亲切的问候

4

0 回答 0