Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 13 of 13
  1. #1
    New Coder
    Join Date
    Aug 2005
    Posts
    52
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Expected end of statement error...

    Expected end of statement error...
    I have two working & no problem link when it work seperately as below:
    Code:
    pagelink = "browsebypkg.asp?Pkgtype="&request("Pkgtype")
    pagelink = "browsebypkg.asp?Workweek>="&request("tBegin")
    When I combine the two variable into one it give me an error, my code is as
    below:-
    Code:
    pagelink="browsebypkg.asp?Pkgtype='%"&request("Pkgtype")&Workweek>="&request("tBegin")
    Pls help on this Tks...

  • #2
    teh Moderatorinator
    Join Date
    Sep 2004
    Location
    USA
    Posts
    2,472
    Thanks
    4
    Thanked 40 Times in 40 Posts
    Did you mean this?
    Code:
    pagelink = "browsebypkg.asp?Pkgtype='%" & request("Pkgtype") & "Workweek>=" & request("tBegin")
    Good luck

  • #3
    New Coder
    Join Date
    Aug 2005
    Posts
    52
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Brandoe85
    Did you mean this?
    Code:
    pagelink = "browsebypkg.asp?Pkgtype='%" & request("Pkgtype") & "Workweek>=" & request("tBegin")
    Good luck
    Tks for help it's now no problem on showing but when I click on the link it's giving below error:
    Syntax error (missing operator) in query expression
    Look like itcan't store the "tBegin"
    How can I over come this?
    Tks

  • #4
    Senior Coder TheShaner's Avatar
    Join Date
    Sep 2005
    Location
    Orlando, FL
    Posts
    1,126
    Thanks
    2
    Thanked 40 Times in 40 Posts
    Your code is still set up wrong. Not sure what you're looking for, but you need it to look something like:

    Code:
    pagelink = "browsebypkg.asp?Pkgtype='%" & request("Pkgtype") & "'+Workweek>=" & request("tBegin")
    This would result in something like this if Pkgtype = big and tBegin = 15:

    browsebypkg.asp?Pkgtype='%big'+Workweek>=15

    You could probably do without the singe quotes since resolving the link would just be using the result between the = sign and the + sign that I inserted. Again, I don't know what you're attempting, so it all depends on what the outcome of the link should look like. So if you need more help, I would post what the resultant links should look like, because you're the one that has to resolve them. Then me or someone else here could probably help you set up the code to produce those links.

    -Shane

  • #5
    New Coder
    Join Date
    Aug 2005
    Posts
    52
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi,
    Actuall what I need is to provide a second page link of my data, I have no problem to show the data in multipage when I use oly one variable "pkgtype" when I change it to below sql which I ib=nclude another varaible I am having the Syntax error (missing operator) in query expression 'Pkgtype Like '%' 8' Workweek>=15' And WorkWeek >='.
    My code:-



    Code:
    sql4="select * from tblFiles where Pkgtype Like '%"&request("Pkgtype")&"' And WorkWeek >= "&request("Beginww")&" order by  WorkWeek DESC"
    pagelink="browsebypkg.asp?Pkgtype='%"&request("Pkgtype")&"'+Workweek>="&request("Beginww")
    firstpage = pagelink & "&page=1"
    prevpage = pagelink & "&page=" & (page-1)
    nextpage = pagelink & "&page=" & (page+1)
    lastpage = pagelink & "&page=" & FinalPage

  • #6
    Senior Coder TheShaner's Avatar
    Join Date
    Sep 2005
    Location
    Orlando, FL
    Posts
    1,126
    Thanks
    2
    Thanked 40 Times in 40 Posts
    Ok, I see the problem now and what you're trying to do. Change your link to this:

    Code:
    pagelink= "browsebypkg.asp?Pkgtype=" & request("Pkgtype") & "&Workweek>=" & request("Beginww")
    Your link doesn't need the single quotes or the percent sign, because your SQL query just needs to pull the value. You've already included single quotes and the percent sign in the query.

    -Shane

  • #7
    New Coder
    Join Date
    Aug 2005
    Posts
    52
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by TheShaner
    Ok, I see the problem now and what you're trying to do. Change your link to this:

    Code:
    pagelink= "browsebypkg.asp?Pkgtype=" & request("Pkgtype") & "&Workweek>=" & request("Beginww")
    Your link doesn't need the single quotes or the percent sign, because your SQL query just needs to pull the value. You've already included single quotes and the percent sign in the query.

    -Shane
    Hi Shane tks for helping, After I change the link to what u propose it seem that the page cannot store the "Beginww" variable...error code as below:
    Syntax error (missing operator) in query expression 'Pkgtype Like '%208' and WorkWeek >='.

  • #8
    Senior Coder TheShaner's Avatar
    Join Date
    Sep 2005
    Location
    Orlando, FL
    Posts
    1,126
    Thanks
    2
    Thanked 40 Times in 40 Posts
    On your page, do you really have an input called Beginww that has a value? Because in your first post, you were using tBegin. So what variable is the correct one? That may be why you're not getting a value there.

    You can also check to see what's stored in a variable real quick by adding onClick="javascript: alert(<variable here>)" to one of your links to see if there's something being stored in that variable when you click the link.

    Looks like the only problem you have is just getting that value, so everything else is at least working (or so it seems).

    -Shane

  • #9
    New Coder
    Join Date
    Aug 2005
    Posts
    52
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by TheShaner
    On your page, do you really have an input called Beginww that has a value? Because in your first post, you were using tBegin. So what variable is the correct one? That may be why you're not getting a value there.

    You can also check to see what's stored in a variable real quick by adding onClick="javascript: alert(<variable here>)" to one of your links to see if there's something being stored in that variable when you click the link.

    Looks like the only problem you have is just getting that value, so everything else is at least working (or so it seems).

    -Shane
    Hi Shane below are my first page code:-
    Code:
    tBegin = request("beginww")
    Start Week: <select name="beginww" id="beginww">
    <% if tBegin = "" then tBegin = 1
    for t = 1 to 53%>
    <option value="<%=t%>" <%if t = cint(tBegin) then%>selected<%end if%>><%=t%></option>\
    hope you will help me, I do got stuck over here. It seems that I only can get the value on first load & point to the link also giving me the value as below
    browsebypkg.asp?Pkgtype='%208Workweek>=15&page=2

  • #10
    Senior Coder TheShaner's Avatar
    Join Date
    Sep 2005
    Location
    Orlando, FL
    Posts
    1,126
    Thanks
    2
    Thanked 40 Times in 40 Posts
    Your Beginww isn't being set I think due to some errors in programming. Your ASP code needs to include the output of the HTML in it as a Response.Write, because if not (and if I'm correct), your HTML isn't being looped through as the ASP loops. Try instead:

    Code:
    <% tBegin = request("Beginww") %>
    Start Week: <select name="Beginww" id="Beginww">
    <% If tBegin = "" Then tBegin = 1
      For t = 1 to 53
        Response.Write "<option value=" & t 
        If t = CInt(tBegin) Then Response.Write " SELECTED"
        Response.Write ">" & t & "</option>"
      Next
    %>
    </select>
    Also, if you had set up the pagelink like I suggested before, you should NOT end up with:

    browsebypkg.asp?Pkgtype='%208Workweek>=15&page=2

    There is a single quote and percent sign still in front of the 208 that should not be there and there should be an ampersand (&) between 208 and Workweek. Set up your link like I suggested before:

    Code:
    pagelink= "browsebypkg.asp?Pkgtype=" & request("Pkgtype") & "&Workweek>=" & request("Beginww")
    That should produce instead a link like:

    browsebypkg.asp?Pkgtype=208&Workweek>=15&page=2

    -Shane

  • #11
    Regular Coder
    Join Date
    Sep 2004
    Posts
    152
    Thanks
    0
    Thanked 0 Times in 0 Posts
    This is what you had posted.
    Code:
    sql4="select * from tblFiles where Pkgtype Like '%"&request("Pkgtype")&"' And WorkWeek >= "&request("Beginww")&" order by  WorkWeek DESC"
    pagelink="browsebypkg.asp?Pkgtype='%"&request("Pkgtype")&"'+Workweek>="&request("Beginww")
    firstpage = pagelink & "&page=1"
    prevpage = pagelink & "&page=" & (page-1)
    nextpage = pagelink & "&page=" & (page+1)
    lastpage = pagelink & "&page=" & FinalPage
    This is the end result of what I did to fix it.
    Code:
    sql4 = "select * from tblFiles where Pkgtype Like '%" & request("Pkgtype") & "' And WorkWeek >= " & request("Beginww") & " order by  WorkWeek DESC"
    pagelink = "browsebypkg.asp?Pkgtype=" & request("Pkgtype") & "&Beginww=" & request("Beginww")
    firstpage = pagelink & "&page=1"
    prevpage = pagelink & "&page=" & (page-1)
    nextpage = pagelink & "&page=" & (page+1)
    lastpage = pagelink & "&page=" & FinalPage

  • #12
    Senior Coder TheShaner's Avatar
    Join Date
    Sep 2005
    Location
    Orlando, FL
    Posts
    1,126
    Thanks
    2
    Thanked 40 Times in 40 Posts
    Yeah, what neocool00 said ^^

    (I forgot to take out that greater than sign in there... oops!)

    -Shane

  • #13
    New Coder
    Join Date
    Aug 2005
    Posts
    52
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I got it tks a lot for help Neocool00 & Shane.Appreciated your great help...


  •  

    Posting Permissions

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