Results 1 to 3 of 3

Thread: search for match data from a accessdatabase

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 2006
    Posts
    120

    search for match data from a accessdatabase

    i have a set of data which have two field (ID and Title).

    i have two textbox and 1 button.

    after i key in "data of Title field" in textbox1 and click the commandbutton, i want the match "ID data" show in textbox2.

    How to do that?

  2. #2
    Frenzied Member brin351's Avatar
    Join Date
    Mar 2007
    Location
    Land Down Under
    Posts
    1,293

    Re: search for match data from a accessdatabase

    In brief you'd do

    'connect to DB
    'issue oledbcommand

    because you only want to return 1 value you can use executeScalar with a select statement like (SELECT id FROM yourTable WHERE title = '@title')

    'add parameter > commandName.parameter.addwithvalue("@title", textbox1.text)

    'execute command

    dim theID as string = commandName.executeScalar()

    textBox2.text = theID

    If you are unsure of the code that accomplishes this I'd suggest studing ADO.NET

  3. #3
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: search for match data from a accessdatabase


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