Create User Wizard Insert Issue

I have placed a create user wizard on a page and added two textbox
fields in addition for First name (id = FirstName) and Last Name (id =

However when I try to insert all the information into my created table
all I get is errors.  I've tried for hours to understand various web
examples and just am missing something.  Below is my vb code on my
code behind page.  I keep getting "NullReferenceException was
unhandled by user code"

My database table does not accept nulls for First or Last names.  But
since these values have always been provided when "testing" something
else must be happening.

Imports System.Data.SqlClient
Imports System.Web.UI.Control

Partial Class register
    Inherits System.Web.UI.Page

    Protected Sub CreateUserWizard1_CreatedUser(ByVal sender As
Object, ByVal e As System.EventArgs) Handles
        If Not Page.IsValid Then Exit Sub

        ' Determine the currently logged on user's UserId
        Dim newUser As MembershipUser =
        Dim newUserId As Guid = CType(newUser.ProviderUserKey, Guid)

        Dim FirstName As TextBox =
CType(CreateUserWizard1.FindControl("FirstName"), TextBox)
        Dim LastName As TextBox =
CType(CreateUserWizard1.FindControl("LastName"), TextBox)

        Dim connectionString As String =
        Dim insertSql As String = "INSERT INTO
aspnet_UserDetails(Userid, FirstName, LastName) VALUES(@UserId,
@FirstName, @LastName)"

        Using myConnection As New SqlConnection(connectionString)
            Dim myCommand As New SqlCommand(insertSql, myConnection)
            myCommand.Parameters.AddWithValue("@UserId", newUserId)
        End Using

    End Sub

I am guessing possibly that I am not gathering the information from
the text boxes correctly by the code above.  If so can someone advise
what that code might be using plain english and an example so I may
better understand.

Thanks in advance.
5/17/2010 6:27:12 AM
dotnet.framework.aspnet 1425 articles. 0 followers. Follow

1 Replies

Similar Articles

[PageSpeed] 12

On May 17, 8:27=A0am, sjsean <> wrote:
> I am guessing possibly that I am not gathering the information from
> the text boxes correctly by the code above. =A0If so can someone advise
> what that code might be using plain english and an example so I may
> better understand.

Just do a little test to be sure that this is not because of anything

Get rid of your code and simply do

Dim FirstName As TextBox =3D
CType(CreateUserWizard1.FindControl("FirstName"), TextBox)

to see if the TextBox was found on the page
5/25/2010 9:35:35 PM

Similar Artilces:

create a roster
How can you create a weekly roster in which functions can be assigned to more than 10 people. The roster should be updatable, so that when holidays and days off are marked on the weekly roster they will be taken account of it future rosters. ...

importing or creating reference footnotes
I am trying to import a word document into publisher and it has reference footnotes within the document. The reference footnotes are not coming into the publisher document with the reference footnotes. Correct, they will not up to Publisher 2003. In Publisher 2003 depending on which version of Word you are using if they will or not. -- "If you don't know where you are going, any road will take you there!" ...

User prompted for password 5 times
One of my users is experiencing a very odd (at least to me) behavior. He is logged into his XP system which is joined to our Active Directory, no problems there. When he launches Outlook hs is prompted for his password for some reason. He has to enter his password and click OK, then repeat this step 5 times before it lets him in. Any thoughts? Thanks I'm having a similar problem. Also running XP and Outlook 2003. Did you get any answers? I haven't tried to authenticate 5 times but that should not be the answer! Right? >-----Original Message----- >One of my users is ex...

XLS file assocation issue
When I goto Associate a file type for a specific extension, it has it associated to Wordpad when it should be Excel. However, I am not able to change it as the "Always Use the selected program to open" is grayed out and I can't get it be selectable. How do I do it so I can associate the file type to always for Excel. Please advise. I wouldn't work with the associations to start. Instead, I'd let excel try to do it for me. Close Excel and Windows Start Button|Run excel /unregserver then Windows Start Button|Run excel /regserver The /unregserve...

Inserting rows with Data, Formula's and Validation
Hi all, I posted this twice earlier today, but it hasn't appeared so if it triple post please forgive! I have a spreadsheet that starting at row 18 contains the following information A18=M$2 B18= Datavalidation indirect ($M$2) C18=IF(B18="No More Options",VLOOKUP($B18,INDIRECT(CONCATENATE($M$2,"_info")),1,FALSE),IF(B19<2,VLOOKUP($B18,INDIRECT(CONCATENATE($M$2,"_info")),1,FALSE),CONCATENATE(B19," x ",VLOOKUP($B18,INDIRECT(CONCATENATE($M$2,"_info")),1,FALSE)))) E18=IF(ISERROR(VLOOKUP($B18,INDIRECT(CONCATENATE($M$2,"_info"))...

How do I include more Help options for really inexperienced users?
Things like on the forms (beside each label), how can i include a question mark symbol that, when the mouse hovers over it, shows the format needed for the data that should be input? e.g. contact number - 028 90 000000 You can easily do this with the Control Tip Text property. Open your form in design view and select the control which you want to show the format for. Open properties and go to the Other tab. Type in your example format in the Control Tip Text property. Steve "laura" <> wrote in message news:57...

Mailbox not created when AD account created
A couple of days ago I noticed that I created a user account but the 'Email Addresses' tab of the user properies did not list any email addresses. Subsequent new user accounts have all experienced the same. I researched the knowledge and tried the recommended solutions to either manaully start the recipient update service or rebuild te recipient update service. Neither recommendation has resulted in a mailbox being created for this particular user or any additional user that I have created since this error first showed up. I performed a Windows update last Thursday and so I bel...

Task Create - Status
I'm trying to make a simple task, when a user owner is assigned a task in CRM, it receives an email letting it know it has one. I have the following below, but it is not generating one when i assign one manually in the CRM. What to do? I've tried both the following: When task is created E-Mail to:[owner];Subject test As well as: When task is created if Task activity status = Open then E-Mail to:[owner];Subject test I've checked the mailserver many times over, and I can send emails manually from the CRM so you can rule that out Tested out ok on our end. Some ideas:...

Help Creating XmlNode / XmlAttribute Elegantly
I am creating a configuration class to read / write a standard configuration file. <?xml version="1.0" encoding="utf-8"?> <configuration> <appSettings> <add key="ConnectionString" value="server=(local);" /> </appSettings> </configuration> I am using a XmlDocument for my base implementation. I am looking to see if there is a better way to add a new node / attribute than using XmlDocument.InnerXml. I would consider this to be a hack but couldn't really see another way of doing this without definin...

Create external database
Hi all. I need to create an external database (file). On a site I found this code: ------------------------------------------------------ Function CreateLinkedExternalTable(strTargetDB As String, strProviderString As String, strSourceTbl As String, strLinkTblName As String) As String 'strTargetDB = Source Database Name 'strProviderString = Not used, currently hard coded 'strSourceTbl = Source Table name in the database we are linking too. 'strLinkTblName = Table name we would like to see in the Access Database. Dim catDB As ADOX.Catalog Dim tblLink As...

How to create pie chart with %
I have got a problem that I don't if excel could help me to calculate the % within a column and draw a pie chart. My case is I have a column containing a series of numbers. e.g. 1,4,8,1,3,9,11,2,4,5,6,.........etc I want to draw a pie chart that showing 1-3 , 4-6, 7-9, >9 with the corresponding % inside that column. Can anyone tell me how can I make it ? Ray - You need to calculate the frequencies in your data. Let's assume your data is in A1:A12. In B1:B3 enter these numbers, the upper limits on the groupings: 3 6 9 You can enter ">9" into B4 witho...

Email address not created when a new user is created
All, This issue recently happened in my company. Upon creating a new user, the policy was set to create the smtp and X400 address automaticaly. Now when we create a user the smtp and x400 addresses are not created, and when attempting to setup the new user in outlook, the address cant be found. We are using exchange 2003 SP1 on Win2k3 servers. On Wed, 13 Jul 2005 06:49:07 -0700, "Bryan" <> wrote: >All, >This issue recently happened in my company. Upon creating a new user, the >policy was set to create the smtp and X400 addres...

Macro to insert Hard Space (character 160)?
Hello, Is there a very simple macro out there that would let me insert character 160 (the hard space) into the current cell? I am looking for something like this because I want to be able to apply "accountant single" and "accountant double" underlining to a blank cell, and Excel seems to demand that some text be IN the cell before it will underline it. The hard space works perfectly, but it would be nice to be able to automate it. Many thanks for any advice, Edward Mendelson Sub HardSpace() ActiveCell.Value = ActiveCell.Value & Chr(160) End Sub Jerry Edward...

Insert Record
Sir i want to insert record one sheet cells into another sheets cells through command button. after saving data second data will save on next row Try this with Command Button on Sheet1: Private Sub CommandButton1_Click() Dim LRow As Long Dim MyCell As String LRow = Sheet2.Cells(Rows.Count, "A").End(xlUp).Row If IsEmpty(Sheet2.Cells(LRow, 1)) Then LRow = LRow Else LRow = LRow + 1 End If MyCell = ActiveCell.Address Sheet2.Cells(LRow, 1).Value = ActiveCell.Value Sheet1.Range(MyCell).Activate End Sub Mike F "Sohail khan" <Sohail khan@discus...

Exchange 2010 MRM, no log files being created
I'm hoping someone can help me with this has been driving me crazy for days. I have enabled MRM logging on our exchange server, and I can see that some of the policies are working when I run start-managedfolderassistant. We have a retention policy tag on the deleteditems folder, and this does work. The problem is I am not getting any files in the MRM log directory. C:\Program Files\Microsoft\Exchange Server\V14\Logging\Managed Folder Assistant Events 9021 and 9022 are logged in the Application log, but where are the files? Below is the output of my mai...

when form created
I have a form which was created by someone else (not a form template) which is like a questionnaire with empty boxes to be completed. When the boxes are typed in all the margins move to accommodate the words being typed. Is there a way to fix/lock the original form and then just fill in the blank boxes? I suspect this is set up as a table with auto resizing enabled. Displaying table gridlines (Table | Show Gridlines) will help you see what you're dealing with. Then select the table, go to the Table tab of Table Properties, click Options, and clear the check box for "A...

POP3 issue: intermittent prob sending email
Since last weekend I've had an intermittent problem with users sending email to external addresses. It only affects users using POP3. So, my company is - from their email address they can send to other users but not external addresses like yahoo, hotmail or etc. The thing is that this comes and goes. Some folks are using cable/DSL and having them reboot the routers/modems has helped. When they try to send out to external addresses it bounces immediately with the error - "Your message did not reach some or all of the ...

Managed user test
Posting this to see if my id identies me properly as a managed user. ------=_NextPart_0001_06BAC655 Content-Type: text/plain Content-Transfer-Encoding: 7bit Lisa, No, the tool that I'm using (an internal Microsoft Tool we use) doesn't show your thread as any of the "Managed" types of users. I only see this post because I was looking from Outlook Express from home last night and saw this query. Today I looked for it under Managed Users, didn't find it, then switch to "All" postings and there you were. I confess while I can answer technical types of ques...

Creating a Brochure
How do you create a 3-column brochure from scratch for Publisher 2002? I can only find the directions for the 2003 version. Quick help would be appreciated, project is due Monday. Create a three-panel or four-panel folded publication Scroll down to the section that says "Build a three-panel or four-panel publications from scratch." -- Mary Sauer MSFT MVP news:// "Derek" <> wrote in message news...

How to create Access macro shortcut
I'm still using Access 97 and saw something the other day that I would like to use that was in Access 2000. In an Access 2000 database, there was a .mam file in a directory that launched the Access 2000 program and ran a macro. How do you set this up? Can it be done in Access 97? If so, how? Hi. > How do you set this up? Select the macro in the Database Window and right click with your mouse, then select "Create Shortcut..." in the pop-up menu. Follow the prompts for where to place the shortcut and what to name it. The default is: <PathToDeskTopDir>\Shortcut ...

OWA and Domain\User Name Logon
Something strange happened to the logon requirements when logging onto OWA... Initially when I configured OWA the user was required to use his or her domain with their username when logging onto OWA. Now, the domain portion before the user name is no longer required. Although more convenient for the user to logon this way, I'd like to see the logon requirements as they were with the domain portion of the logon required. I am wondering what could have happened to change this feature. Any ideas? How would one change it back? Thanks in advance. Raymond- If somebody put a \ in the default...

Users mailboxes not created when user created
I have a problem that recently just started happening on my exchange 2003 server. When i create a new user account and create the mailbox for exchange, once im done, the mailbox isnt created, adn if you go into the properties of the user account adn go to the exchange email address tab, there isnt an smtp or an x.400 address listed. I am having to manually create and add these, adn then go delete the exchange mailbox and recreate it. This is really annoying and would love to know if anyone has any ideas of how to fix it. Thanks Jason In news:9F836A43-98BF-435A-AA43-AFF10124BE3F@micro...

Single user Outlook 2007 license for desktop and laptop
What is the cheapest way I can get an Outlook 2007 license that I can use on both my desktop and laptop? Richard As long as you are the only user, the license in a retail box is good for a desktop and a portable. it is not good for a desktop and a laptop if you and your spouse both use the computers - it has to be for computers that won't both be used at the same time. I highly recommend buying the office suite, not just outlook - you'll have a better experience when all of the office apps are the same version. -- Diane Poremsky [MVP - Outlook] Author, Teach Yourself Outlook 2...

CRM should let me create custom fields in batch
Hi, With MS CRM v3.0, when we have a group of fields to create, it would be faster to be able to enter the list and then submit the list for processing. Thank you. Felix. ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open the suggestion in the Microsoft Web-based Newsreader and then click "I Agree" in the message pane.

Creating an ad book
How do I divide a page into equal sections (halves, qarters, eights)? I need to scan and type ads and coupons into this booklet. New at this. After managing to set up OE-QuoteFix on his new PC, Ed reads a message from FRSH <>... > How do I divide a page into equal sections (halves, qarters, eights)? Arrange > Layout Guides > Grid Guides -- Ed Bennett - MVP Microsoft Publisher Before reading this message, view the disclaimer: ...