I have placed a create user wizard on a page and added two textbox\nfields in addition for First name (id = FirstName) and Last Name (id =\nLastName)\n\nHowever when I try to insert all the information into my created table\nall I get is errors. I've tried for hours to understand various web\nexamples and just am missing something. Below is my vb code on my\ncode behind page. I keep getting "NullReferenceException was\nunhandled by user code"\n\nMy database table does not accept nulls for First or Last names. But\nsince these values have always been provided when "testing" something\nelse must be happening.\n\n\nImports System.Data.SqlClient\nImports System.Web.UI.Control\n\n\nPartial Class register\n Inherits System.Web.UI.Page\n\n Protected Sub CreateUserWizard1_CreatedUser(ByVal sender As\nObject, ByVal e As System.EventArgs) Handles\nCreateUserWizard1.CreatedUser\n If Not Page.IsValid Then Exit Sub\n\n ' Determine the currently logged on user's UserId\n Dim newUser As MembershipUser =\nMembership.GetUser(CreateUserWizard1.UserName)\n Dim newUserId As Guid = CType(newUser.ProviderUserKey, Guid)\n\n\n Dim FirstName As TextBox =\nCType(CreateUserWizard1.FindControl("FirstName"), TextBox)\n Dim LastName As TextBox =\nCType(CreateUserWizard1.FindControl("LastName"), TextBox)\n\n\n\n\n\n Dim connectionString As String =\n \nConfigurationManager.ConnectionStrings("ApplicationServices").ConnectionString\n Dim insertSql As String = "INSERT INTO\naspnet_UserDetails(Userid, FirstName, LastName) VALUES(@UserId,\n@FirstName, @LastName)"\n\n Using myConnection As New SqlConnection(connectionString)\n myConnection.Open()\n Dim myCommand As New SqlCommand(insertSql, myConnection)\n myCommand.Parameters.AddWithValue("@UserId", newUserId)\n myCommand.Parameters.AddWithValue("@FirstName",\nFirstName.Text.Trim())\n myCommand.Parameters.AddWithValue("@LastName",\nLastName.Text.Trim())\n myCommand.ExecuteNonQuery()\n myConnection.Close()\n End Using\n\n\n End Sub\n\n\nI am guessing possibly that I am not gathering the information from\nthe text boxes correctly by the code above. If so can someone advise\nwhat that code might be using plain english and an example so I may\nbetter understand.\n\nThanks in advance.