[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

How to find contents of a table in a string

Posted on 2008-06-11
4
Medium Priority
?
198 Views
Last Modified: 2013-12-17
Given a string, usually a long sentence, how will I know if the contents of my table is part of that string.

ex. string = "the quick brown fox jump over the lazy dog"
myTableContents = dog, cat, fox, pig

I wanna get all the words from the string that exists in my table.  How will I do that using C#.net, and I'm using Access database.

0
Comment
Question by:meredithf
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 1

Accepted Solution

by:
miketob earned 375 total points
ID: 21762782
Use the split method to separate your sentence into words, it will result in an array of words, then cycle through this arry serching for each word in your table.

Regards

0
 
LVL 6

Expert Comment

by:Bruce_1975
ID: 21766851
Just to give you an other idea
Regards,
Bruce
string givenString = "the quick brown fox jump over the lazy dog";
foreach (string item in myTableContents)
{
    if (givenString.IndexOf(item) > -1)
        Debug.WriteLine(item + " is included");
}

Open in new window

0
 

Expert Comment

by:bmoabc
ID: 21772833
You can also return the resuts of a simple SQL if your table contents are unique records

SELECT table.[myTableContents]
FROM table
WHERE ((("sentence" Like "*" & table.[myTableContents] & "*")=True));

This will provide all the records send it to an array or another query, whatever you need...
0
 

Author Comment

by:meredithf
ID: 21809933
Thanks miketob for the idea.  It works.
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

650 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