Solved

Help with partial string search using Substring

Posted on 2014-02-20
5
264 Views
Last Modified: 2014-02-20
Hi,


How do you modify the Substring below which searches for the first three characters in a field to search for part of the data in a data field,

For example if the field contains 9999-00-999-9999 Ho do I search only for 00, considering xyz '''00'".

Dim SearchCriteria as String = "Substring(SN, 1,3) IN ('" & xyz &"')

Thanks,

Victor
0
Comment
Question by:vcharles
  • 3
5 Comments
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 500 total points
ID: 39874177
Use the Like operator

Dim SearchCriteria as String = "SN LIKE '%" & xyz &"%'"
0
 
LVL 24

Expert Comment

by:mankowitz
ID: 39874183
I think what you are saying is that if you have a field like

9999-00-999-9999

You want to search against the 6-7th characters instead of the 1-3rd characters, right?

Dim SearchCriteria as String = "Substring(SN, 6,2) IN ('" & xyz &"')
0
 

Author Comment

by:vcharles
ID: 39874395
Thank You for both answers, I will get back to you.

Victor
0
 

Author Comment

by:vcharles
ID: 39875104
Hi,

I was able to solve the issue withthe code below.

Dim SearchCriteria as String = "SN LIKE '%" & xyz &"%'"


Thanks,

Victor
0
 

Author Closing Comment

by:vcharles
ID: 39875105
Thank You.
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question