...

View Full Version : Expected end of statement error...



cs168
09-09-2005, 02:51 PM
Expected end of statement error...
I have two working & no problem link when it work seperately as below:


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:-

pagelink="browsebypkg.asp?Pkgtype='%"&request("Pkgtype")&Workweek>="&request("tBegin")
Pls help on this Tks...

Brandoe85
09-09-2005, 03:00 PM
Did you mean this?


pagelink = "browsebypkg.asp?Pkgtype='%" & request("Pkgtype") & "Workweek>=" & request("tBegin")


Good luck

cs168
09-09-2005, 03:07 PM
Did you mean this?


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

TheShaner
09-09-2005, 04:05 PM
Your code is still set up wrong. Not sure what you're looking for, but you need it to look something like:


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

cs168
09-09-2005, 04:27 PM
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:-





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

TheShaner
09-09-2005, 05:06 PM
Ok, I see the problem now and what you're trying to do. Change your link to this:


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

cs168
09-09-2005, 05:36 PM
Ok, I see the problem now and what you're trying to do. Change your link to this:


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 >='.

TheShaner
09-09-2005, 05:52 PM
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

cs168
09-09-2005, 06:08 PM
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:-


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

TheShaner
09-09-2005, 06:58 PM
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:


<% 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:


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

neocool00
09-09-2005, 07:20 PM
This is what you had posted.

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.

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

TheShaner
09-09-2005, 07:34 PM
Yeah, what neocool00 said ^^ :thumbsup:

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

-Shane

cs168
09-10-2005, 09:41 AM
I got it tks a lot for help Neocool00 & Shane.Appreciated your great help...



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum