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
ASPMicrosoft Access

Avatar of undefined
Last Comment
Wayne Barron
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
Wayne Barron
Flag of United States of America image

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

Avatar of Wayne Barron
Wayne Barron
Flag of United States of America image

ASKER

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

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Gustav Brock
Gustav Brock
Flag of Denmark image

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

Avatar of Wayne Barron
Wayne Barron
Flag of United States of America image

ASKER

@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
Microsoft Access
Microsoft Access

Microsoft Access is a rapid application development (RAD) relational database tool. Access can be used for both desktop and web-based applications, and uses VBA (Visual Basic for Applications) as its coding language.

226K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo