We help IT Professionals succeed at work.

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

Wayne Barron
Wayne Barron asked
on
89 Views
Last Modified: 2019-04-10
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
Comment
Watch Question

John TsioumprisSoftware & Systems Engineer
CERTIFIED EXPERT
Distinguished Expert 2019

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

Wayne BarronAuthor, Web Developer
CERTIFIED EXPERT
Top Expert 2009

Author

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

John TsioumprisSoftware & Systems Engineer
CERTIFIED EXPERT
Distinguished Expert 2019

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

Wayne BarronAuthor, Web Developer
CERTIFIED EXPERT
Top Expert 2009

Author

Commented:
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.
John TsioumprisSoftware & Systems Engineer
CERTIFIED EXPERT
Distinguished Expert 2019

Commented:
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.
Consulting
CERTIFIED EXPERT
Distinguished Expert 2017
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
CERTIFIED EXPERT
Most Valuable Expert 2015
Distinguished Expert 2018

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

Wayne BarronAuthor, Web Developer
CERTIFIED EXPERT
Top Expert 2009

Author

Commented:
@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
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.