1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Whats wrong with syntax please

Discussion in 'C#' started by maz, Sep 5, 2006.

  1. #1
    Hi

    I get this error

    Microsoft VBScript compilation error '800a03ee'

    Expected ')'

    /new/MaintainCat.asp, line 10

    Response.Redirect ("MaintainCat_2.asp?CatCode=<%= rstCatItems("CatCode")) "
    ---------------------------------------------------------------^

    This is the code. Can I ask what is incorrect, and perhaps a correction to the syntax please. TIA

    If Session("AdminPriveledges") = False Then
    
     Response.Redirect ("default_2.asp?CatCode=<%= rstCatItems("CatCode")) "
    
    Code (markup):
     
    maz, Sep 5, 2006 IP
  2. Mano70

    Mano70 Peon

    Messages:
    42
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    If Session("AdminPriveledges") = False Then
    
    Response.Redirect ("default_2.asp?CatCode=" &  rstCatItems("CatCode"))
    Code (markup):
     
    Mano70, Sep 5, 2006 IP
  3. ludwig

    ludwig Notable Member

    Messages:
    2,253
    Likes Received:
    66
    Best Answers:
    0
    Trophy Points:
    225
    #3
    yes the above example should be correct

    your mistake was <%

    you shouldn't write <% inside <%
     
    ludwig, Sep 6, 2006 IP
  4. maz

    maz Banned

    Messages:
    14
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Thanks for your replies.

    I tried something similar but Type mismatch error, the same with Mano's snippet.:confused:
     
    maz, Sep 6, 2006 IP
  5. maz

    maz Banned

    Messages:
    14
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Mano, should there be a "&" on the right side aswell?
     
    maz, Sep 6, 2006 IP
  6. ludwig

    ludwig Notable Member

    Messages:
    2,253
    Likes Received:
    66
    Best Answers:
    0
    Trophy Points:
    225
    #6
    no you don't need it
     
    ludwig, Sep 6, 2006 IP
  7. ludwig

    ludwig Notable Member

    Messages:
    2,253
    Likes Received:
    66
    Best Answers:
    0
    Trophy Points:
    225
    #7
    what is rstCatItems("CatCode")) equal to? maybe the problem is there????
     
    ludwig, Sep 6, 2006 IP
  8. maz

    maz Banned

    Messages:
    14
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Yes, I think it is. I'll take a look at it later, at home!....

    CatCode is being used for soemthing else I think
     
    maz, Sep 6, 2006 IP
  9. vectorgraphx

    vectorgraphx Guest

    Messages:
    545
    Likes Received:
    16
    Best Answers:
    0
    Trophy Points:
    0
    #9
    type mismatch most likely means you're trying to compare apples to oranges, i.e. you're trying to match up a text string with a numeric field. i would verify that you're not doing that, and if you're trying to compare numbers to numbers and still getting the error, try doing a string convert i.e.

    newcatcode = cNum(catcode)
     
    vectorgraphx, Sep 6, 2006 IP
  10. maz

    maz Banned

    Messages:
    14
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #10
    Thanks a lot..Ok, heres the code - some non essential bits.

    Firstly: -

    CatCode is the primary key column, data type = text

    <a class="cataitems" href="default.asp?CatCode=<%= rstCatItems("CatCode") %> 
    Code (markup):
    ...works fine, in that the URL based on the catcode is written and functions.

    When a user requests a records, if they have no logged, then they are redirected to an alternative page. Dont ask!:-D

    ===============================CODE-----------------

    
    
    <%
    Option Explicit
    Response.Expires = 0
    Response.Buffer = True
     If Session("AdminPriveledges") = False Then
    
    Response.Redirect ("default_2.asp?CatCode=" &  rstCatItems("CatCode")) 
    
    End if
    %>
    
    '==============================
    
    
    <%
      Dim cnnCatalogue, rstCatItems, fsoFile
      Dim strSQL
      Dim strCatCode, strCatDescription
      Dim intcatPack, curCatUnitPrice
      Dim strCatNotes
      Dim strCatCurrency
    %>
    
    '=============================
    
    Set cnnCatalogue = Server.CreateObject("Conn") ==== conn is just something ive put there temp
      strConn = "DSN=me;UID=me;PWD=me"
      cnnCatalogue.Open strConn
      
    ' Create recordset object...
      Set rstCatItems = Server.CreateObject("ADODB.Recordset")
    
    ' Create filesystem object...
      Set fsoFile = Server.CreateObject("Scripting.FilesystemObject")
    
      If Len(Request.QueryString("CatCode")) > 0 Then
      ' A catcode has been supplied...
        strCatCode = Trim(Request.QueryString("CatCode"))
        rstCatItems.CursorLocation = adUseServer
        rstCatItems.CursorType = adOpenKeyset
        rstCatItems.LockType = adLockOptimistic
        strSQL = "SELECT * FROM CatItems WHERE CatCode='" & strCatCode & "'"
        rstCatItems.Open strSQL, cnnCatalogue
        If Not rstCatItems.BOF and Not rstCatItems.EOF Then
        ' Retrieve row from the recordset...
          rstCatItems.MoveFirst
          If Len(Request.QueryString("CatAction")) > 0 Then
          ' An action has been supplied...
            Select Case Request.QueryString("CatAction")
            Case "Update"
            ' Update catalogue item...
              strCatDescription = Trim(Request.Form("CatDescription"))
              intcatPack = CInt(Request.Form("catPack"))
              strCatCurrency = Trim(Request.Form("CatCurrency"))
              curCatUnitPrice = CCur(Request.Form("CatUnitPrice"))
              strCatNotes = Trim(Request.Form("CatNotes"))
              rstCatItems("CatCode") = strCatCode
              rstCatItems("CatDescription") = strCatDescription
              rstCatItems("catPack") = 1
              rstCatItems("CatCurrency") = strCatCurrency
              rstCatItems("CatUnitPrice") = curCatUnitPrice
              rstCatItems("CatNotes") = strCatNotes
              rstCatItems.Update
              Response.Write "blah blah<br><br>"
            Case "Delete"
            ' Delete catalogue item...
              rstCatItems.Delete
              Response.Write "blah blah<br><br>"
            End Select
          Else
          ' Display catalogue item...
            strCatCode = rstCatItems("CatCode")
            strCatDescription = rstCatItems("CatDescription")
            intcatPack = rstCatItems("catPack")
            strCatCurrency = rstCatItems("CatCurrency")
            curCatUnitPrice = rstCatItems("CatUnitPrice")
            strCatNotes = rstCatItems("CatNotes") %>
    
    '=============================
    
    
    Code (markup):
    :eek:
     
    maz, Sep 6, 2006 IP
  11. ludwig

    ludwig Notable Member

    Messages:
    2,253
    Likes Received:
    66
    Best Answers:
    0
    Trophy Points:
    225
    #11
    in place of
    Response.Redirect ("default_2.asp?CatCode=" & rstCatItems("CatCode"))

    try this
    Response.Redirect "default_2.asp?CatCode=" & rstCatItems("CatCode")

    was the error here or on some other line, please highlight it
     
    ludwig, Sep 7, 2006 IP
  12. maz

    maz Banned

    Messages:
    14
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #12
    Hi

    Yes the error occured on the same line.

    I'll try it out.

    I think this might solve the problem though.

    Let me explain: - display page with listing, when the user clicks a link, a popup window shows with further details on that products. I think it might be somethign to so with that fact the the previous method did not have any variable to compare or evaluate?

    TIA


    Option Explicit
    
    Response.Expires = 0
    
    Response.Buffer = True
    
    Dim tmpCat
    
    tmpCat = Request.QueryString("CatCode")
    
    If Session("AdminPriveledges") = False Then
    
     
    
    Response.Redirect ("default_2.asp?CatCode=" &  tmpCat) 
    Code (markup):


    End if
     
    maz, Sep 7, 2006 IP
  13. ludwig

    ludwig Notable Member

    Messages:
    2,253
    Likes Received:
    66
    Best Answers:
    0
    Trophy Points:
    225
    #13
    let us know when you check it
     
    ludwig, Sep 7, 2006 IP
  14. maz

    maz Banned

    Messages:
    14
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #14
    sure....I will a little later

    cheers
     
    maz, Sep 7, 2006 IP
  15. maz

    maz Banned

    Messages:
    14
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #15
    hi, yes that idea solved the problem, and it passed on the variable almost without problem. Now it seems that there is a problem with map path, and server vars Script Name, aarrrhhh - since the images don't display.

    But, the above did solve the problem....:eek:


    cheers
     
    maz, Sep 7, 2006 IP
  16. ludwig

    ludwig Notable Member

    Messages:
    2,253
    Likes Received:
    66
    Best Answers:
    0
    Trophy Points:
    225
    #16
    hope you can solve the problem with servermappath, if not let us know :)
     
    ludwig, Sep 7, 2006 IP
  17. maz

    maz Banned

    Messages:
    14
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #17
    maz, Sep 8, 2006 IP
  18. maz

    maz Banned

    Messages:
    14
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
  19. ludwig

    ludwig Notable Member

    Messages:
    2,253
    Likes Received:
    66
    Best Answers:
    0
    Trophy Points:
    225
    #19
    i figured it out :)
     
    ludwig, Sep 9, 2006 IP