Results 1 to 2 of 2

Thread: Searching a database in a random order

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Aug 2012
    Posts
    17

    Searching a database in a random order

    Hi,

    I'm trying to search through a database with a GUI that I've made, and it searches just fine when I do it in a specific order like:

    John Joseph Smith

    However when I look for something like

    John Smith

    without the middle name it seems to just go blank and can't seem to do it. Is there a way to do this??


    The code for search is:
    Code:
     Private Sub FullNameTextBox_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSearch.Click
            Try
                Me.ContactsTableAdapter.Search(Me.Linkedcontacttbls.Contacts, FullNameTextBox.Text)
                LBSearch.Update() 'LbSearch is the listbox
            Catch op As System.InvalidOperationException
                System.Windows.Forms.MessageBox.Show(op.Message)
            Finally
            End Try
        End Sub
    Any help would be appreciated!
    Also VB version is: VB 2010

  2. #2
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,532

    Re: Searching a database in a random order

    The default search method in the adaptors only does an exact match... if you want something less exacting, then you'll need to write one yourself with the appropriate wildcard settings based on just how you want to conduct the search.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width