Results 1 to 10 of 10

Thread: Registration Form error...{RESOLVED}

  1. #1

    Thread Starter
    ^:^...ANGEL...^:^ wrack's Avatar
    Join Date
    Mar 2002
    Location
    Melbourne, AUSTRALIA
    Posts
    2,695

    Thumbs up Registration Form error...{RESOLVED}

    Can someone please try this url to register and see what error they are getting...???

    http://wrack.mine.nu/UniProject/Forms/Registration.aspx

    When I run the project by pressing F5 it works like a charm but when someone else try to run that page from Internet they get an error...

    VB Code:
    1. Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    2.         If Not IsPostBack Then
    3.             txtUserName.Text = ""
    4.             txtPassword.Text = ""
    5.             txtFirstName.Text = ""
    6.             txtLastName.Text = ""
    7.             txtAddress.Text = ""
    8.             txtSuburb.Text = ""
    9.             txtCity.Text = ""
    10.             txtState.Text = ""
    11.             txtPostCode.Text = ""
    12.             txtCountry.Text = "Australia"
    13.             txtEMail.Text = ""
    14.             txtContact.Text = ""
    15.         End If
    16.     End Sub
    17.  
    18.     Private Sub cmdReset_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdReset.Click
    19.         txtUserName.Text = ""
    20.         txtPassword.Text = ""
    21.         txtFirstName.Text = ""
    22.         txtLastName.Text = ""
    23.         txtAddress.Text = ""
    24.         txtSuburb.Text = ""
    25.         txtCity.Text = ""
    26.         txtState.Text = ""
    27.         txtPostCode.Text = ""
    28.         txtCountry.Text = "Australia"
    29.         txtEMail.Text = ""
    30.         txtContact.Text = ""
    31.     End Sub
    32.  
    33.     Private Sub cmdSubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSubmit.Click
    34.         Dim cnnRegistration As SqlConnection
    35.         Dim cmdRegistration As SqlCommand
    36.         Dim dtrRegistration As SqlDataReader
    37.         Dim strSQL As String
    38.  
    39.         cnnRegistration = New SqlConnection("server=WRACK\SQLDB;uid=sa;pwd=;database=NW;")
    40.  
    41.         strSQL = "SELECT [UserName] FROM tblUsers Where UserName = '" & txtUserName.Text & "' ORDER BY [UserName]"
    42.         cmdRegistration = New SqlCommand(strSQL, cnnRegistration)
    43.         cnnRegistration.Open()
    44.         dtrRegistration = cmdRegistration.ExecuteReader
    45.  
    46.         If dtrRegistration.Read() Then
    47.             If Trim(txtUserName.Text) = Trim(dtrRegistration("UserName")) Then
    48.                 lblError.Text = "User Name is not available. Please choose another User Name."
    49.             End If
    50.         Else
    51.             dtrRegistration.Close()
    52.             cnnRegistration.Close()
    53.  
    54.             strSQL = "INSERT INTO tblUsers " & _
    55.                     "(" & _
    56.                     "[UserName], [Password], [FirstName], [LastName] ," & _
    57.                     "[Address], [Suburb], [City], [State], [PostCode] ," & _
    58.                     "[Country], [EMail], [Contact]" & _
    59.                     ") VALUES (" & _
    60.                     "'" & txtUserName.Text & "', '" & txtPassword.Text & "', " & _
    61.                     "'" & txtFirstName.Text & "', '" & txtLastName.Text & "', " & _
    62.                     "'" & txtAddress.Text & "', '" & txtSuburb.Text & "', " & _
    63.                     "'" & txtCity.Text & "', '" & txtState.Text & "', " & _
    64.                     "'" & txtPostCode.Text & "', '" & txtCountry.Text & "', " & _
    65.                     "'" & txtEMail.Text & "', '" & txtContact.Text & "')"
    66.  
    67.             cmdRegistration = New SqlCommand(strSQL, cnnRegistration)
    68.  
    69.             cnnRegistration.Open()
    70.  
    71.             If ValidateEntry(txtUserName.Text, txtPassword.Text, txtFirstName.Text, _
    72.                                 txtLastName.Text, txtAddress.Text, txtSuburb.Text, _
    73.                                 txtCity.Text, txtState.Text, txtPostCode.Text, _
    74.                                 txtCountry.Text, txtEMail.Text) = True Then
    75.  
    76.                 dtrRegistration = cmdRegistration.ExecuteReader
    77.                 lblError.Text = "Registration successful...Please go to Login page to gain access."
    78.             End If
    79.         End If
    80.  
    81.         dtrRegistration.Close()
    82.         cnnRegistration.Close()
    83.     End Sub
    84.  
    85.     Private Function ValidateEntry(ByVal s1 As String, _
    86.                                    ByVal s2 As String, _
    87.                                    ByVal s3 As String, _
    88.                                    ByVal s4 As String, _
    89.                                    ByVal s5 As String, _
    90.                                    ByVal s6 As String, _
    91.                                    ByVal s7 As String, _
    92.                                    ByVal s8 As String, _
    93.                                    ByVal s9 As String, _
    94.                                    ByVal s10 As String, _
    95.                                    ByVal s11 As String) As Boolean
    96.         If s1 = "" Then
    97.             lblError.Text = "*UserName is REQUIRED."
    98.             ValidateEntry = False
    99.         Else
    100.             If s2 = "" Then
    101.                 lblError.Text = "*Password is REQUIRED."
    102.                 ValidateEntry = False
    103.             Else
    104.                 If s3 = "" Then
    105.                     lblError.Text = "*FirstName is REQUIRED."
    106.                     ValidateEntry = False
    107.                 Else
    108.                     If s4 = "" Then
    109.                         lblError.Text = "*LastName is REQUIRED."
    110.                         ValidateEntry = False
    111.                     Else
    112.                         If s5 = "" Then
    113.                             lblError.Text = "*Address is REQUIRED."
    114.                             ValidateEntry = False
    115.                         Else
    116.                             If s6 = "" Then
    117.                                 lblError.Text = "*Suburb is REQUIRED."
    118.                                 ValidateEntry = False
    119.                             Else
    120.                                 If s7 = "" Then
    121.                                     lblError.Text = "*City is REQUIRED."
    122.                                     ValidateEntry = False
    123.                                 Else
    124.                                     If s8 = "" Then
    125.                                         lblError.Text = "*State is REQUIRED."
    126.                                         ValidateEntry = False
    127.                                     Else
    128.                                         If s9 = "" Then
    129.                                             lblError.Text = "*PostCode is REQUIRED."
    130.                                             ValidateEntry = False
    131.                                         Else
    132.                                             If s10 = "" Then
    133.                                                 lblError.Text = "*Country is REQUIRED."
    134.                                                 ValidateEntry = False
    135.                                             Else
    136.                                                 If s11 = "" Then
    137.                                                     lblError.Text = "*EMail is REQUIRED."
    138.                                                     ValidateEntry = False
    139.                                                 Else
    140.                                                     If Len(s5) > 100 Then
    141.                                                         lblError.Text = "*Address can not be more than 100 characters."
    142.                                                         ValidateEntry = False
    143.                                                     Else
    144.                                                         ValidateEntry = True
    145.                                                     End If
    146.                                                 End If
    147.                                             End If
    148.                                         End If
    149.                                     End If
    150.                                 End If
    151.                             End If
    152.                         End If
    153.                     End If
    154.                 End If
    155.             End If
    156.         End If
    157.     End Function

    I am getting this error...
    Attached Images Attached Images  
    Last edited by wrack; Jun 1st, 2003 at 10:50 PM.

  2. #2
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    I get an error, but I can't see it because you have your custom error setting in your web config to something other than 'Off' If you set it to Off, then we can see the errors and get them back to you.

  3. #3
    Frenzied Member EyeTalion's Avatar
    Join Date
    Jul 2000
    Location
    New York
    Posts
    1,075
    same here. get run-time error, but no description...also, you may want to place this code in it's own procedure...

    VB Code:
    1. txtUserName.Text = ""
    2.         txtPassword.Text = ""
    3.         txtFirstName.Text = ""
    4.         txtLastName.Text = ""
    5.         txtAddress.Text = ""
    6.         txtSuburb.Text = ""
    7.         txtCity.Text = ""
    8.         txtState.Text = ""
    9.         txtPostCode.Text = ""
    10.         txtCountry.Text = "Australia"
    11.         txtEMail.Text = ""
    12.         txtContact.Text = ""
    It's tough being an unhandled exception...

    ___________
    VB.NET 2008
    VB.NET 2010
    ORACLE 11g
    CRYSTAL 11

  4. #4

    Thread Starter
    ^:^...ANGEL...^:^ wrack's Avatar
    Join Date
    Mar 2002
    Location
    Melbourne, AUSTRALIA
    Posts
    2,695
    Originally posted by hellswraith
    I get an error, but I can't see it because you have your custom error setting in your web config to something other than 'Off' If you set it to Off, then we can see the errors and get them back to you.
    I will do it staight away...Please try again and let me know...

    Cheers...

  5. #5

    Thread Starter
    ^:^...ANGEL...^:^ wrack's Avatar
    Join Date
    Mar 2002
    Location
    Melbourne, AUSTRALIA
    Posts
    2,695
    Originally posted by EyeTalion
    same here. get run-time error, but no description...also, you may want to place this code in it's own procedure...

    VB Code:
    1. txtUserName.Text = ""
    2.         txtPassword.Text = ""
    3.         txtFirstName.Text = ""
    4.         txtLastName.Text = ""
    5.         txtAddress.Text = ""
    6.         txtSuburb.Text = ""
    7.         txtCity.Text = ""
    8.         txtState.Text = ""
    9.         txtPostCode.Text = ""
    10.         txtCountry.Text = "Australia"
    11.         txtEMail.Text = ""
    12.         txtContact.Text = ""
    What exactly do u mean...??? You mean a seperate SUB and call it...

    Cheers...

  6. #6
    Frenzied Member DevGrp's Avatar
    Join Date
    Nov 2001
    Location
    Charlotte, NC
    Posts
    1,256
    Yes thats what he means. Also, you should use the error provider instead of using all those if else tests.

  7. #7

    Thread Starter
    ^:^...ANGEL...^:^ wrack's Avatar
    Join Date
    Mar 2002
    Location
    Melbourne, AUSTRALIA
    Posts
    2,695
    Originally posted by DevGrp
    Yes thats what he means. Also, you should use the error provider instead of using all those if else tests.
    OK I will use SUB and change it when I go home...

    I try to used those RequiredValidator but the moment I hit the SUBMIT button all the fields were cleared and an EMPTY record was inserted into database...Note that the values weren't NULL so it went allright...

    So I was pissed off and removed all of them and then used that long IF ELSE END IF thingy...

    Cheers...

  8. #8
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    Code:
    Private Function ValidateEntry(ByVal s1 As String, _
                                       ByVal s2 As String, _
                                       ByVal s3 As String, _
                                       ByVal s4 As String, _
                                       ByVal s5 As String, _
                                       ByVal s6 As String, _
                                       ByVal s7 As String, _
                                       ByVal s8 As String, _
                                       ByVal s9 As String, _
                                       ByVal s10 As String, _
                                       ByVal s11 As String) As Boolean
            If s1 = "" Then
                lblError.Text = "*UserName is REQUIRED."
                ValidateEntry = False
            Else
                If s2 = "" Then
                    lblError.Text = "*Password is REQUIRED."
                    ValidateEntry = False
                Else
                    If s3 = "" Then
                        lblError.Text = "*FirstName is REQUIRED."
                        ValidateEntry = False
                    Else
                        If s4 = "" Then
                            lblError.Text = "*LastName is REQUIRED."
                            ValidateEntry = False
                        Else
                            If s5 = "" Then
                                lblError.Text = "*Address is REQUIRED."
                                ValidateEntry = False
                            Else
                                If s6 = "" Then
                                    lblError.Text = "*Suburb is REQUIRED."
                                    ValidateEntry = False
                                Else
                                    If s7 = "" Then
                                        lblError.Text = "*City is REQUIRED."
                                        ValidateEntry = False
                                    Else
                                        If s8 = "" Then
                                            lblError.Text = "*State is REQUIRED."
                                            ValidateEntry = False
                                        Else
                                            If s9 = "" Then
                                                lblError.Text = "*PostCode is REQUIRED."
                                                ValidateEntry = False
                                            Else
                                                If s10 = "" Then
                                                    lblError.Text = "*Country is REQUIRED."
                                                    ValidateEntry = False
                                                Else
                                                    If s11 = "" Then
                                                        lblError.Text = "*EMail is REQUIRED."
                                                        ValidateEntry = False
                                                    Else
                                                        If Len(s5) > 100 Then
                                                            lblError.Text = "*Address can not be more than 100 characters."
                                                            ValidateEntry = False
                                                        Else
                                                            ValidateEntry = True
                                                        End If
                                                    End If
                                                End If
                                            End If
                                        End If
                                    End If
                                End If
                            End If
                        End If
                    End If
                End If
            End If
        End Function
    or:
    Code:
    Private Function ValidateEntry(ByVal s1 As String, _
                                       ByVal s2 As String, _
                                       ByVal s3 As String, _
                                       ByVal s4 As String, _
                                       ByVal s5 As String, _
                                       ByVal s6 As String, _
                                       ByVal s7 As String, _
                                       ByVal s8 As String, _
                                       ByVal s9 As String, _
                                       ByVal s10 As String, _
                                       ByVal s11 As String) As Boolean
            If s1 = "" Then
                lblError.Text = "*UserName is REQUIRED."
                Return False
            End If
    
            If s2 = "" Then
                 lblError.Text = "*Password is REQUIRED."
                Return False
            End If
    
            If s3 = "" Then
                 lblError.Text = "*FirstName is REQUIRED."
                Return False
             End If
    
             If s4 = "" Then
                lblError.Text = "*LastName is REQUIRED."
                Return False
            End If
    
            If s5 = "" Then
               lblError.Text = "*Address is REQUIRED."
               Return False
            End If
    
            If s6 = "" Then
                lblError.Text = "*Suburb is REQUIRED."
                Return False
            End If
    
            If s7 = "" Then
                lblError.Text = "*City is REQUIRED."
                Return False
            End If
    
            If s8 = "" Then
               lblError.Text = "*State is REQUIRED."
               Return False
            End If
    
            If s9 = "" Then
                 lblError.Text = "*PostCode is REQUIRED."
                Return False
            End If
    
            If s10 = "" Then
                  lblError.Text = "*Country is REQUIRED."
                  Return False
            End If
    
            If s11 = "" Then
                  lblError.Text = "*EMail is REQUIRED."
                  Return False
            End If
    
            If Len(s5) > 100 Then
                  lblError.Text = "*Address can not be more than 100 characters."
                  Return False
            End If
    
            Return True
        End Function
    If you are going to do it that way, at least make it easier to look through.

  9. #9

    Thread Starter
    ^:^...ANGEL...^:^ wrack's Avatar
    Join Date
    Mar 2002
    Location
    Melbourne, AUSTRALIA
    Posts
    2,695
    Originally posted by hellswraith
    Code:
    Private Function ValidateEntry(ByVal s1 As String, _
                                       ByVal s2 As String, _
                                       ByVal s3 As String, _
                                       ByVal s4 As String, _
                                       ByVal s5 As String, _
                                       ByVal s6 As String, _
                                       ByVal s7 As String, _
                                       ByVal s8 As String, _
                                       ByVal s9 As String, _
                                       ByVal s10 As String, _
                                       ByVal s11 As String) As Boolean
            If s1 = "" Then
                lblError.Text = "*UserName is REQUIRED."
                ValidateEntry = False
            Else
                If s2 = "" Then
                    lblError.Text = "*Password is REQUIRED."
                    ValidateEntry = False
                Else
                    If s3 = "" Then
                        lblError.Text = "*FirstName is REQUIRED."
                        ValidateEntry = False
                    Else
                        If s4 = "" Then
                            lblError.Text = "*LastName is REQUIRED."
                            ValidateEntry = False
                        Else
                            If s5 = "" Then
                                lblError.Text = "*Address is REQUIRED."
                                ValidateEntry = False
                            Else
                                If s6 = "" Then
                                    lblError.Text = "*Suburb is REQUIRED."
                                    ValidateEntry = False
                                Else
                                    If s7 = "" Then
                                        lblError.Text = "*City is REQUIRED."
                                        ValidateEntry = False
                                    Else
                                        If s8 = "" Then
                                            lblError.Text = "*State is REQUIRED."
                                            ValidateEntry = False
                                        Else
                                            If s9 = "" Then
                                                lblError.Text = "*PostCode is REQUIRED."
                                                ValidateEntry = False
                                            Else
                                                If s10 = "" Then
                                                    lblError.Text = "*Country is REQUIRED."
                                                    ValidateEntry = False
                                                Else
                                                    If s11 = "" Then
                                                        lblError.Text = "*EMail is REQUIRED."
                                                        ValidateEntry = False
                                                    Else
                                                        If Len(s5) > 100 Then
                                                            lblError.Text = "*Address can not be more than 100 characters."
                                                            ValidateEntry = False
                                                        Else
                                                            ValidateEntry = True
                                                        End If
                                                    End If
                                                End If
                                            End If
                                        End If
                                    End If
                                End If
                            End If
                        End If
                    End If
                End If
            End If
        End Function
    or:
    Code:
    Private Function ValidateEntry(ByVal s1 As String, _
                                       ByVal s2 As String, _
                                       ByVal s3 As String, _
                                       ByVal s4 As String, _
                                       ByVal s5 As String, _
                                       ByVal s6 As String, _
                                       ByVal s7 As String, _
                                       ByVal s8 As String, _
                                       ByVal s9 As String, _
                                       ByVal s10 As String, _
                                       ByVal s11 As String) As Boolean
            If s1 = "" Then
                lblError.Text = "*UserName is REQUIRED."
                Return False
            End If
    
            If s2 = "" Then
                 lblError.Text = "*Password is REQUIRED."
                Return False
            End If
    
            If s3 = "" Then
                 lblError.Text = "*FirstName is REQUIRED."
                Return False
             End If
    
             If s4 = "" Then
                lblError.Text = "*LastName is REQUIRED."
                Return False
            End If
    
            If s5 = "" Then
               lblError.Text = "*Address is REQUIRED."
               Return False
            End If
    
            If s6 = "" Then
                lblError.Text = "*Suburb is REQUIRED."
                Return False
            End If
    
            If s7 = "" Then
                lblError.Text = "*City is REQUIRED."
                Return False
            End If
    
            If s8 = "" Then
               lblError.Text = "*State is REQUIRED."
               Return False
            End If
    
            If s9 = "" Then
                 lblError.Text = "*PostCode is REQUIRED."
                Return False
            End If
    
            If s10 = "" Then
                  lblError.Text = "*Country is REQUIRED."
                  Return False
            End If
    
            If s11 = "" Then
                  lblError.Text = "*EMail is REQUIRED."
                  Return False
            End If
    
            If Len(s5) > 100 Then
                  lblError.Text = "*Address can not be more than 100 characters."
                  Return False
            End If
    
            Return True
        End Function
    If you are going to do it that way, at least make it easier to look through.
    By your method is two fields are empty then it will overwrite the previous message in the lable...

    But as far as I understand there is no problem doing the method I am using right now...

    Problem is somewhere else...

    Cheers...

  10. #10

    Thread Starter
    ^:^...ANGEL...^:^ wrack's Avatar
    Join Date
    Mar 2002
    Location
    Melbourne, AUSTRALIA
    Posts
    2,695

    Thumbs up

    Just as I suspected...I just added a new form and copied all the controls and code to new and damn....Its working now like a charm...

    Thanks for all ur support...

    Cheers...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width