Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    Regular Coder Baleric's Avatar
    Join Date
    Feb 2005
    Location
    Australia
    Posts
    332
    Thanks
    0
    Thanked 0 Times in 0 Posts

    searching a whole database

    hi, i would liek to know if it is possible to search a hole database in asp, every table basically, thanks in advance

    -baleric

  • #2
    Regular Coder Baleric's Avatar
    Join Date
    Feb 2005
    Location
    Australia
    Posts
    332
    Thanks
    0
    Thanked 0 Times in 0 Posts
    .... anyone?

  • #3
    Senior Coder BarrMan's Avatar
    Join Date
    Feb 2005
    Location
    Israel.
    Posts
    1,644
    Thanks
    69
    Thanked 83 Times in 82 Posts
    I don't think you can search for the whole database but you can always search for each table and save the results with arrays.

    Code:
    Dim x, i
    i = 0
    For x = 1 to NumOfTablesInDatbase
    SQL = "SELECT * FROM table" & x & " WHERE (condition)"
    While not rs.eof
    ArrayName(i) = rs("name")
    ArrayId(i) = rs("id")
    Array("type") = rs("type")
    'etc etc
    i = i + 1
    rs.movenext
    Wend
    Next

  • #4
    Regular Coder Baleric's Avatar
    Join Date
    Feb 2005
    Location
    Australia
    Posts
    332
    Thanks
    0
    Thanked 0 Times in 0 Posts
    im not that pro of a coder lol.. thanks anyways

  • #5
    Regular Coder
    Join Date
    May 2005
    Location
    Michigan, USA
    Posts
    566
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You can also get a list of tables in the DB by using the system tables.
    Note: I do not test code. I just write it off the top of my head. There might be bugs in it! But if any thing I gave you the overall theory of what you need to accomplish. Also there are plenty of other ways to accomplish this same thing. I just gave one example of it. Other ways might be faster and more efficient.

  • #6
    Regular Coder
    Join Date
    Aug 2002
    Location
    USA
    Posts
    478
    Thanks
    0
    Thanked 2 Times in 2 Posts
    And of course if the fields are structured the same you could put a bunch of SQL statements together with UNION.

    http://www.w3schools.com/sql/sql_union.asp

    And for a related link (although it only uses one table):

    Classic ASP Design Tips - Search For Keywords on Multiple Fields
    http://www.bullschmidt.com/devtip-se...iplefields.asp
    J. Paul Schmidt
    www.Bullschmidt.com - Freelance Web and Database Developer
    www.Bullschmidt.com/DevTip.asp - Classic ASP Design Tips


  •  

    Posting Permissions

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