locked
Updating some ASP RRS feed

  • Question

  • User-1266225229 posted

    Hi Forum, im converting some ASP VB code to run on.NET2. Im in the process of trans-coding some old code, Im not great at VB so need some help!

    Where im at, setting the cookie! I get this error 

    Compiler Error Message: BC30452: Operator '=' is not defined for types 'System.Web.HttpCookie' and 'Object'.

    Line 18: Select Case Request.Cookies("POLL")
    Line 19: Case RSpc("pc")

    Wednesday, April 30, 2008 9:06 AM

Answers

  • User1191518856 posted

    Select Case Else is executed if none of the other cases in the Select statement matches. The code you provided is taken out of context and it's hard to help you without seeing the rest of the code. But I think you need to read up on the syntax for a Select Case statement. See this link for a working example.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, May 4, 2008 5:34 PM

All replies

  • User1191518856 posted

    Request.Cookies("POLL") will return a string. However, RSpc("pc") seem to return an object. Try converting it like this:

    Case RSpc("pc").ToString()

    Wednesday, April 30, 2008 10:08 AM
  • User810302116 posted

     Hi,

    It seems that you are trying to assign one object to another. If they are not of the same type then you need to cast the object before assigning it.

    Regards
     

    Wednesday, April 30, 2008 10:10 AM
  • User-1266225229 posted

    Hi Johram thanks for your reply, I couldnt convert that set cookie piece so have decided to delete that out and add it in once I get script working. Ive managed to get through most of changes but hit a problem with Case Else, BC30072: 'Case' can only appear inside a 'Select Case' statement.

    So I added Select Case Else, this creates the error BC30201: Expression expected. Ive posted the block of code, hope you can help!! cheers P

    <%

    rsq.Close

    rsq = NOTHING

    rsbc.Close

    rsbc = NOTHING

    rs1.Close

    rs1 = NOTHING

    Select Case Else

    Dim qArr(4)

    sqlq = "Select * from ques WHERE ID = (Select MAX(ID) From pollcount)"

    rsq = ConnPoll.execute(sqlq)

    sqlbc = "Select * from settings WHERE ID = (Select MAX(ID) From pollcount)"

    rsbc = ConnPoll.execute(sqlbc)

    pxl = rsbc(
    "tblW")

    q1 = rsq("q1")

    qArr(0) = rsq("q2")

    qArr(1) = rsq("q3")

    qArr(2) = rsq("q4")qArr(3) = rsq("q5")

    %>


     


     

    Thursday, May 1, 2008 6:40 AM
  • User1191518856 posted

    Select Case Else is executed if none of the other cases in the Select statement matches. The code you provided is taken out of context and it's hard to help you without seeing the rest of the code. But I think you need to read up on the syntax for a Select Case statement. See this link for a working example.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, May 4, 2008 5:34 PM
  • User-1266225229 posted

    Thanks Johram for advice, updating this code has is turning into one of those nightmares, Ive used a conversion tool (asp2aspx) to get through the worst of it! This created a new issue that im trying to resolve. Maybe you could help!! P

    http://forums.asp.net/t/1255864.aspx

    Monday, May 5, 2008 5:34 AM