Integer Issue aspx

Discussion in 'Programming' started by scottlpool2003, Jun 3, 2013.

  1. #1
    Hi

    I'm new to ASP, but basically I'm posting a form from a PHP page to an ASP page (don't ask)

    Anyway, I had it working posting the variable as a string but I need to post it as an integer, and all it returns is 0

        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
     
            'This section outputs 0
            Dim userID As String = Request.Form("userID")
            Dim pubIssueID As String = Request.Form("pubIssueID")
            Response.Write("PubIssueID ")
            Response.Write(pubIssueID)
            Response.Write("<br />")
            Response.Write("userID ")
            Response.Write(userID)
            Response.Write("<br />")
     
            'This section does not output
            If userID <> 0 Then
                If pubIssueID <> 0 Then
                    Response.Write(userID)
                    Response.Write("<br />")
                    Response.Write(pubIssueID)
                End If
            Else
                'This section outputs
                Response.Write("Error, user or publication not found")
            End If
        End Sub
    Code (markup):
    I've commented with a ' where and where not it outputs
     
    Solved! View solution.
    scottlpool2003, Jun 3, 2013 IP
  2. #2
    You're making them strings... and as strings you can't perform numeric operations on them. Change where it says "As String" to "As Integer"
     
    deathshadow, Jun 3, 2013 IP
  3. scottlpool2003

    scottlpool2003 Well-Known Member

    Messages:
    1,708
    Likes Received:
    49
    Best Answers:
    9
    Trophy Points:
    150
    #3
    Sorry, forgot to say thanks. Sometimes its the most obvious solution!

    Thank you.
     
    scottlpool2003, Jun 7, 2013 IP