#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2002
    Posts
    9
    Rep Power
    0

    Unhappy still cant get my database to run


    Well.. I have gone to the sites that mrTed has suggested. And I have read ALL the material.

    I have found what my problem is. I think I am using server-side codes on my page, because its an ASP (VBScript) and because I defined it as a dynamic page. I have all the database connections dont and I think I have the bindings correct.

    The thing is I cant get the search tp give results when I test it. I do have a testign server that works. Just dont get any results.

    I have realized from reading other source codes that my inputs are not hidden. What does that mean, and I am not too sure that I have the SQL to get the from the database and retuen the results.

    Any suggestions? Is there any place I can see a sample sourse code for a database with a search box or table? I know if I get to see some sample codes (and Server Side) I can modify it to work on mine.

    Need your help.

    Newtothis
  2. #2
  3. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2002
    Location
    a northern town
    Posts
    74
    Rep Power
    13
    Hi,

    This will send a string to an asp page, search.asp...

    <form name="find" method="post" action="search.asp">
    <input type="text" name="searchtext" size="15">
    <input type="submit" name="submit">
    </form>

    ...then in search.asp, you can run your search query like this...

    request_text = Request.Form("searchtext") 'This gets the value entered into the form and puts it into the var 'request_text'.

    sqlStr = "SELECT [Field Name] FROM [Table Name] WHERE [Field Name] LIKE '%" & request_text & "%'" 'This builds the sql query. NOTE the use of the like CLAUSE to search for records similar to your search criteria. This is possibly why you get no results?

    cnn.open "WHATEVER?" 'open the connection
    rsSearch.open sqlStr, cnn 'do the query

    'loop through if there are any results returned?
    Do While Not rsSearch.EOF
    response.write rsSearch("Field Name")
    rsSearch.MoveNext
    Loop

    This is a bit vague, but I don't know what your database schema is like?. If you show us what you have so far, then we may be able to see what is causing the problems.

    Can you connect to the database? Can you return and display any records?

    (And please reply to this post with your further comments rather than posting a new topic.)

    Regards, Ed.
    /* measure twice, cut once */
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2002
    Posts
    9
    Rep Power
    0
    Well.... mr Ted. I want to thank you for all your your help so far.

    I plan to try everything you suggested. However, I have no idea what a schema is? Could you enlighten me please. That may be where all my problems lie.

    There is so much to learn here, and I am willing to learn.

    Thanks
  6. #4
  7. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2002
    Location
    a northern town
    Posts
    74
    Rep Power
    13
    Hi,

    Schema simply relates to the construction or layout of your database. Simply put, it is the composition of tables and fields within tables relating to datatypes and form which constitute your particular implementation.

    I refer to it in my example because I don't know how your database is constructed, so I can only give a general example.

    Just have a go as I suggested, read a few tutorials and you should get some stuff working pretty quickly.

    Regards, Ed.
    /* measure twice, cut once */
  8. #5
  9. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2002
    Posts
    9
    Rep Power
    0

    not using a schema...still need help


    mrTed,

    Once again I thank you for your replies to my questions and queries.

    Just to let you know, I am not using a schema as I am using Access to create the database. By the way I am designing this project using Dreamweaver MX. But here's what I want to do.

    I have a table, named ClientInfo and in this table I have the following tables:-

    IDnum(Primary key), Surname, Firstname, Dept, Address, State, CoursesTaken, Certifications, Experience, Comments, Email.

    Now what want to do is allow people to search the database using the following fields:- CoursesTaken, Certifications, Dept, State. I want to allow the user to search the fileds using a drop down menu box. (Thats the search page)

    Then I want to return results into a table with the Surname, Firstname (with the search fields as the heading to the table).

    From this I want the user to be able to get a more detailed page of the individual records which will display:-
    Firstname, Surname, CoursesTaken, Certifications, Experience, Comments and Email. (this I understand is done via a master/detailed page link using the Primary key (IDnum)

    In addition to which if the user just presses "enter" to submit the form using the defaults, I want to be able to conduct a wildcard search to return all the records in the data.

    It have tried writing this code using the bulit-in templates of Dreamweaver MX but I can not get anything, just nothing, and when I do get something, its a blank page or an error message.

    I want to use VB or JSP, or even Javascript. Is there any suggestions on how to write this code by hand?

    I know this is much, but I am really lost and just cant seem to get anything right. I know how to write web pages in html, but this database is killing me.

    Appreciate the help so far

    newtothis
  10. #6
  11. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2002
    Location
    a northern town
    Posts
    74
    Rep Power
    13
    Hi,

    I think you need to start with the basic stuff and build on it to eventually do all you want. You will be better off(although a bit frustrated for a while...) doing this yourself and understanding what is happening rather than someone just writing it for you, although I don't mind helping you. Once you have done a few things in your list, you will be amazed how quickly it will all become clear!

    Firstly, I would use my previous example and just edit it slightly for your database, so keep the search form intact but change the result page to...

    request_text = Request.Form("searchtext")

    sqlStr = "SELECT [Firstname], [Surname] FROM [ClientInfo] WHERE [CoursesTaken] LIKE '%" & request_text & "%'"

    cnn.open "WHATEVER?"
    rsSearch.open sqlStr, cnn, 2, 2

    'loop through if there are any results returned?
    Do While Not rsSearch.EOF
    response.write rsSearch("Forename") & " " & rsSearch("Surname")
    rsSearch.MoveNext
    Loop

    This will select the records from Clientinfo where the Coursestaken = whatever you put in the text box on the form. This should get you in the right direction. Once this works then try to figure out how to search on multiple fields and how to extract values from drop down lists.

    Regards, Ed.
    /* measure twice, cut once */
  12. #7
  13. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2002
    Posts
    9
    Rep Power
    0

    will try that and see what works


    mrTed

    Thanks again.

    I will try that and see what works.. then I will see if I can add some more complex searches.

    Thanks

    newtothis

IMN logo majestic logo threadwatch logo seochat tools logo