Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Week 53

Status
Not open for further replies.

DirtDawg

IS-IT--Management
Apr 17, 2002
218
JP
Ok,

At this time I have a sql query as follows

sqlstring = "select top 4 vslvoy, wkn, srv, sumtwn from VSL where wkn between'" & strwkn & "' and ('" & strwkn & "')+4 and srv = '" & strsrv & "' order by wkn"

the problem is that there is no 54,55,56 it should be 54=01, 55=02,56=03 is there a way to make this query work this way
 
Some what sparse for getting an actually useful response. We, the receiptants, have no access to the data and even less to the intemd / meaning of the various fields discriptions.





MichaelRed


 
What about this ?
sqlstring = "select top 4 vslvoy, wkn+1-" & strwkn & " as no, srv, sumtwn" _
& " from VSL where wkn between " & strwkn & " and " & strwkn & "+4 and srv='" & strsrv & "' order by 2"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
For the statement what I am trying to do is search for 4 rows
IE infomation on week number 51 52 53 01
But It will only let me get 51 52 53

Plus I need to keep them in the order of the search
51 52 53 01 week after would be 52 53 01 02

any help would be great
 
I have played with it a little and this is what I have but i keeps givin me an error at OR


if strwkn = 51 then
wkn1 = "01"
elseif strwkn = 52 then
wkn1= "02"
elseif strwkn = 53 then
wkn1 = "03"
else
wkn1 = strwkn+4
end if


If strwkn = 51 Then
strAndOr = "Or"
Else
strAndOr = "And"
End If


If Descending Then
strDesc = "DESC"
End If

sqlstring = "select vslvoy, wkn, srv, sumtwn from VSL where srv = '" & strsrv & "' AND (wkn >= '" & strwkn & "' '" & strAndOr & "' wkn <= '" & strwkn & "')"

 
Code:
If strwkn = 51 Then
strAndOr = " Or "
Else
strAndOr = " And "
End If

And (of course) corresponding adjustment(s) tot he remainder of the code?







MichaelRed


 
Michael,

Thanks for your help but I am still having a problem
on the following code I am getting it at the < side. The second wkn <= still gives me and error

sqlstring = "select vslvoy, wkn, srv, sumtwn from VSL where (wkn >='" & strwkn & "'& strAndOr & wkn <= '" & strwk1 & "') and srv = '" & strsrv & "' ORDER BY '" & strOrderBy & "'
 
sqlstring = "select vslvoy, wkn, srv, sumtwn from VSL where (wkn >='" & strwkn & "'& strAndOr & "wkn <='" & strwk1 & "') and srv = '" & strsrv & "' ORDER BY " & strOrderBy

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
OOps, sorry for the typo:
sqlstring = "select vslvoy, wkn, srv, sumtwn from VSL where (wkn >='" & strwkn & "'" & strAndOr & "wkn <='" & strwk1 & "') and srv = '" & strsrv & "' ORDER BY " & strOrderBy

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
PHV,

Thanks it is working until I want 01 or 02 or 03 to appear then it gives me the following ASP error

Error Type:
ADODB.Field (0x80020009)
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
/rof/tw/mrkt/4week/Taiwan/wk4.asp


Browser Type:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; istb 702; .NET CLR 1.1.4322)

Page:
POST 26 bytes to /rof/tw/mrkt/4week/Taiwan/wk4.asp

POST Data:
wkn=51&srv=EU2&B1=Continue

Time:
2004?12?7?, 9:21:49

If I put on error resume next then I will get 51 52 53 01 is blank.

I really appreciate your help on this though
 
All thank you for your help. I have completed my code as follows:

if strwkn = 51 then
strwkn1 = "01"
elseif strwkn = 52 then
strwkn1= "02"
elseif strwkn = 53 then
strwkn1 = "03"
else
strwkn1 = strwkn+4
end if

If strwkn <= 51 or strwkn <= 52 or strwkn <= 53 Then
strAndOr = " Or "
strOrderBy = "Case when wkn >='" & strwkn & "' then wkn-53 else wkn end"
Else
strAndOr = " And "
strOderBy = " wkn "
End If



sqlstring = "select vslvoy, wkn, srv, sumtwn from VSL where (wkn >='" & strwkn & "'" & strAndOr & "wkn <='" & strwkn1 & "') and srv = '" & strsrv & "' ORDER BY " & strOrderBy

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top