Search database by user input

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cewynn
    New Member
    • Feb 2008
    • 5

    Search database by user input

    I am a beginner working in visual studio 2005 and I created an application to keep track of my movie database.
    I created 2 forms,
    1st form has my movies listed and
    2 form is a search form.
    I can not figure out the code for find actor box and search box to fine items in the fields, example, try to find actor, and hit search and nothing comes up
    can you help please

    Thanks
    Ed.

    basically I need code for search button to fine actor by name. (actor is in dataset)
  • Shashi Sadasivan
    Recognized Expert Top Contributor
    • Aug 2007
    • 1435

    #2
    have you created the SQL statements needed to do the search by actor?

    Try running that in your database toverify the syntax and output

    Comment

    • cewynn
      New Member
      • Feb 2008
      • 5

      #3
      Originally posted by Shashi Sadasivan
      have you created the SQL statements needed to do the search by actor?

      Try running that in your database toverify the syntax and output
      I would not know what the sql statment would be. I know I could search by actor, but do not know how to get started and display the results.

      Thanks

      Comment

      • Shashi Sadasivan
        Recognized Expert Top Contributor
        • Aug 2007
        • 1435

        #4
        the sql statement would be something to similar to the following

        string sqlstring = "select * from myMoviesTable where actorName like '%"+actornameTe xt + "%'";

        try running a sql querty in your database console

        select * from myMoviesTable where actorName like '%tim%'

        to learn more about sql queries, look into sql tutorial by w3schools

        Comment

        • cewynn
          New Member
          • Feb 2008
          • 5

          #5
          Thank you very much for the information

          Comment

          Working...