jampost
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_descriptionT oolStripBu tton_Click (ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Search_Item_a_descriptionT oolStripBu tton.Click
Try
Me.CustomerOrdersTableAdap ter.Search _Item_a_de scription( Me.OrdersS earchDataS et.Custome rOrders, Item_a_descriptionToolStri pTextBox.T ext)
Catch ex As System.Exception
System.Windows.Forms.Messa geBox.Show (ex.Messag e)
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.
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_descriptionT
Try
Me.CustomerOrdersTableAdap
Catch ex As System.Exception
System.Windows.Forms.Messa
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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?
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?
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you all for your help. I used bits and pieces of all the comments and it is working well. Thanks again.
ASKER
Thank you, I will test this and get back to you shortly. -- Jampost