Solved

Using a textbox to do a fuzzy lookup

Posted on 2006-11-13
6
511 Views
Last Modified: 2008-02-01
Hi there, the scenario of my problem is: A user can type in a string in a textbox, when he clicks the button the string must be used to do a fuzzy lookup with a reference table. If there is any similarities(where the _Similarity column > 0) between the string and a reference table it must show the fuzzyresults in a datagridview below the textbox.

Thanks.
0
Comment
Question by:cErasmus
[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
6 Comments
 
LVL 2

Expert Comment

by:amiableansari
ID: 17929209

take a datatable and fill it with something that you want to show in datagrid

mDT = new DataTable();
mAdapter.Fill(mDT);                  
dgTest.DataSource = mDT;

now when the user clicks on the button make a dataview and add a filter expression and assign it to the datagrid.

private void button1_Click(object sender, System.EventArgs e)
{
        DataView mView = mDT.DefaultView;
      mView.RowFilter = "ur_ref_fieldname like '" + textBox1.Text + "%'";
      dgTest.DataSource = mView;
}

0
 
LVL 14

Expert Comment

by:nayernaguib
ID: 17929435
I think you missed another wildcard character before the text.

     mView.RowFilter = "ur_ref_fieldname like %'" + textBox1.Text + "%'";

_______________

  Nayer Naguib
0
 
LVL 1

Author Comment

by:cErasmus
ID: 17929436
I tried this, but like is not going to work for me. You see I want to, lets say a guy wants to buy a product, but first he has to check his stock so he enters the product's name, lets say he wants to buy a "Brown glasshouse" so he enters it. Now I check in stock, and in my stock I have "Brown glasscasing". Is this possible? I would like to use something like this in a front-end program? Doing a fuzzy search outside of SSIS?
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 4

Accepted Solution

by:
tobydavid earned 500 total points
ID: 17932015
You might find Levenshtein Distance useful.  This is a measure of (dis)similarity between two strings based on the number of changes it would take to turn the first string into the second.  Here is a good source of additional information

http://www.merriampark.com/ld.htm

It also contains the code you would need for either Java, C++, or Visual Basic
0
 
LVL 1

Author Comment

by:cErasmus
ID: 17954502
Thanks, but I already solved it, i'll still reward you.
0
 
LVL 4

Expert Comment

by:tobydavid
ID: 17955499
Thank you.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ejb example issues 3 88
SQL Insert parts by customer 12 61
Developing database that gets updated from Excel. Looking for best approach 5 67
Is online banking safe? 11 121
Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
This is about my first experience with programming Arduino.

734 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