Link to home
Start Free TrialLog in
Avatar of Wayne Barron
Wayne BarronFlag for United States of America

asked on

ASP Classic and access database - get value between / Forward Slash

Hello, All.
(ASP Classic / Access Database)

OK, I am working on a project for our family home use.
In this project, I am using an Access Database.
(This makes it easier if I port it over to someone else's computer if they would like to use it.)

The column (CASTID) has the following
4807/11056/11055/11054/11053/2011/11052/11051/11050/10897/11049/

Open in new window


OK, let's say you only wanted to return the value for
2011
How would you ask that in Access, that will work in ASP Classic?

I asked a similar question over here.
However, it is for SQL Server.

I tried the code from netminder, and I am uncertain about how to get it to work with my current project.

Wayne
Avatar of John Tsioumpris
John Tsioumpris
Flag of Greece image

What exactly you want to return...all i see is a row of numbers separated by slashes...
EDIT: Well i took a look at your other question ...if you want something similar in Access here is a way to do it :
Sub SplitBetweenSlashes()
Dim b() As String
Dim s As String
s = "4807/11056/11055/11054/11053/2011/11052/11051/11050/10897/11049/"
b = Split(s, "/")
'Now the b Array holds all the values as array entries
End Sub

Open in new window

Avatar of Wayne Barron

ASKER

Hello, John.
I wrote this.


OK, let's say you only wanted to return the value for
2011

So, in the string, all I would want to return would be that number.

Also, in Classic ASP all I have to do to get the numbers separated is this.

<%
s = split("4807/11056/11055/11054/11053/2011/11052/11051/11050/10897/11049/", "/")
for each x in s
response.Write x & "<br />"
next
%>

Open in new window

Lets take it from the start...when you say "all I would want to return would be" : 2011 how you expect to get this number...
Following the above code
For i =Lbound(b) to Ubound(b)
if b(i) = 2011 Then
'Some code here for finding 2011
End if
Next

Open in new window

Just a little heads up.
I am using Classic ASP in this project, not. DOT NET.
So, the AS STRING.
For the DIMS, does not need to be added in.

Also, you have lost me on what you are trying to do.
I will look back at this after I get up from some much-needed rest.
I am working on the Access side...in case you want to implement the  "querying" in The BE...if you are after ASP...i am afraid i am not familiar.
ASKER CERTIFIED SOLUTION
Avatar of Fabrice Lambert
Fabrice Lambert
Flag of France image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
In a query, using a parameter named, say, SearchCastID, you can filter on :

Where 
    (Left([CastID], Len([SearchCastID]) + 1) = [SearchCastID] & "/") Or
    (Right([CastID], Len([SearchCastID]) + 1) = "/" & [SearchCastID]) Or
    (InStr([CastID], "/" & [SearchCastID] & "/") > 0)

Open in new window

@Fabrice
Your code did exactly what I needed it to do.
Thank you.

@John.
I was lost in the code you provided for me. And since you noted it was all on the Access side, that got me lost even more.
As some of the code you were providing, looks similar to that of asp.net.

@Gustav
I tried your code, and it would give me a LOT of different results.
I need it to give me ONE record, whichever record is being searched for, is the record that I need to be returned.


Thank, Fabrice
Wayne