SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Aug 2005
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    combining two unrelated tables

    please assist me with this. how can I combine two unrelated tables with SQL. here is what I have and what I want to do

    Table A has the following populated fields
    First_name
    Last_name
    Registration_number
    result1
    result2.and so on

    Table B has the following populated fields

    Pin_number
    Max_visits initialized to 5
    Visit_count initialized to 0

    I want to use SQL/ADO to create a page that can interact with a user in this way : the user has a pin number supplied through a scratch card for example
    he gets to the specified form page, and inputed his name, registration number the pin number that he just got and so on; he expects to get the result of the exam he participated in

    the page should
    (1) look through table A to get his result details if his details is in that table
    (2) look through table B to know if his pin number is in that table too
    (3) combine this two information in a dataset, and grant the user access to the database with this dataset only five times, afteer that he has to buy another pin card for another pin number

    how can I go about this and what changes do I need to do to my tables if there is any please this would make a whole lot of difference on my project

  2. #2
    SitePoint Enthusiast hombre_de_las_ca's Avatar
    Join Date
    Apr 2005
    Location
    Bangalore, India
    Posts
    90
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thumbs up

    try with the following changes:

    Table A has the following populated fields
    First_name
    Last_name
    Registration_number
    Max_visits initialized to 5
    Visit_count initialized to 0

    Table B has the following populated fields

    Pin_number
    result1
    result2
    result3.and so on

    next use datashaping and get a recordset in a hierarchy thus solving your problem...(parent and child format with all the Results of the perticular pin no. in the child set i.e table A fields are the parent fields and table B fields are the child fields)

    put a check on pin no. with the user name and reg no. to grant access.

    if pin no. exists in table A it will return whatever u have put in the database..

    if not then it shows nothing speaking of which, u can check the recordset as

    if objrs.eof then 'check if there are no records
    responce.redirect "home.asp" 'sending to the login page
    else
    ' carry on with yur coding
    end if


    if u dont know about data shaping in asp go to:
    http://www.asp101.com/articles/chris...ng/default.asp

    or else got to google and search...

    also an easier way to create a datashape sql statement with out much thinking is to use Visual Studio.

    hombre_de_las_cavernas
    Don't ask what your Country can do for you,
    Ask what you can do for your Country.


Bookmarks

Posting Permissions

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