Two tables at once

Results 1 to 3 of 3

Thread: Two tables at once

  1. #1
    Adrian Guest

    Default Two tables at once

    I have two table, a Files table and a UserFiles table.<BR>The Files table has all the files that have been registered with my database and the UserFiles has all the files that each user has.<BR>When a user logs on the register all there files and a record is created in the UserFiles for each file they have. i do this in a loop where each time I add a record I look up to see if the file is already in the Files table, if it is not then I add it.<BR><BR>dummy code eg:<BR>for each item in UserFileArray<BR>_UserFilesRec.addnew<BR>_UserFile sRec("UserID")=UserID<BR>_FilesRec=dbc.execute("SE LECT * FromFiles WHERE NAME=&#039"&FileName&"&#039")<BR>_if FilesRec.eof then<BR>__FilesRec.addnew<BR>__FilesRec("FileName" )=FileName<BR>__FilesRec.update<BR>_end if<BR>_UserFilesRec("FileID")=FileRec("ID")<BR>_Fi lesRec.close<BR>next<BR><BR>I know there must be a better way of doing this a opening a database connection in a loop is choking my database, but I cant think of how to do it. Any help would be greatly appreciated.

  2. #2
    Join Date
    Dec 1969

    Default RE: Two tables at once

    you can use JOIN queries - see the article on for details

  3. #3
    Join Date
    Dec 1969

    Default RE: Two tables at once

    I know how to quiry the tables with a join but I dont know how to update the tables.

Posting Permissions

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