Link to home
Start Free TrialLog in
Avatar of jampost
jampostFlag for United States of America

asked on

Search ability is too limited in my VB 2008/ SQL Server program

Is there any thing I can do to create a search of a database table that wil look into the entire cell instaed of just the first word in the cell? Right now it will search a single column and only the first word in each cell for a perfect match.

   If this question is like asking someone to write a program for me, then I would be happy if you could just point me in the right direction; like a book or video. I got the info for my current seach ability from Beth Massi (blogs.msdn), and I must admit, it works great.  

Here is some VB code in the Windows form.
Private Sub Search_Item_a_descriptionToolStripButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Search_Item_a_descriptionToolStripButton.Click
        Try
            Me.CustomerOrdersTableAdapter.Search_Item_a_description(Me.OrdersSearchDataSet.CustomerOrders, Item_a_descriptionToolStripTextBox.Text)
        Catch ex As System.Exception
            System.Windows.Forms.MessageBox.Show(ex.Message)
        End Try

    End Sub

This code in from the table adapter:      

SQL Select statement    Bla Bla Bla     And at the end, I put the following:

WHERE        (Item_a_description LIKE @Item_a_description + '%')

         I did this for a number of columns and they all work, but this is limited and combersome.    Thank you for any help.
ASKER CERTIFIED SOLUTION
Avatar of djon2003
djon2003
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jampost

ASKER

djon2003

   Thank you, I will test this and get back to you shortly.   --     Jampost
Avatar of jampost

ASKER

                   This code did not work, but...  I think your code might work if I have the correct code on the Windows for to correspond with the table adapter code you gave me. Also; where you have Value or Field1  --  should I replace either of those with "Item_a_description" or another column name?
Avatar of jampost

ASKER

  Just correcting a typo-------   Windows form


 This code did not work, but...  I think your code might work if I have the correct code on the Windows form to correspond with the table adapter code you gave me. Also; where you have Value or Field1  --  should I replace either of those with "Item_a_description" or another column name?
Yes, my mistake. I forgot to tell you to replace FieldX and Value by your own variable and fields.
SOLUTION
Avatar of Lowfatspread
Lowfatspread
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jampost

ASKER

Thank you all for your help. I used bits and pieces of all the comments and it is working well.  Thanks again.