Last post May 05, 2008 05:34 AM by plkilroy
Apr 30, 2008 09:06 AM|plkilroy|LINK
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")
Apr 30, 2008 10:08 AM|johram|LINK
Request.Cookies("POLL") will return a string. However, RSpc("pc") seem to return an object. Try converting it like this:
Apr 30, 2008 10:10 AM|mr.aspdotnet|LINK
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.
May 01, 2008 06:40 AM|plkilroy|LINK
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 = ConnPoll.execute(sqlq)
rsbc = ConnPoll.execute(sqlbc)
q1 = rsq(
qArr(1) = rsq(
May 04, 2008 05:34 PM|johram|LINK
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.
May 05, 2008 05:34 AM|plkilroy|LINK
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