Multiple SQL Statements

Results 1 to 4 of 4

Thread: Multiple SQL Statements

  1. #1
    Join Date
    Dec 1969
    Posts
    716

    Default Multiple SQL Statements

    Hiya all,<BR><BR>I am currently doing the following on a page:<BR><BR>Getting user name (dynamic drop-down list)<BR>Getting the date (text entry)<BR>Getting a department (dymanic drop-down list -hopefully-)<BR><BR>Ok the problem is that I can use the SQLstmt to retrieve what I need from the username list but the department list is (and would preferably stay) in a seperate table completely.<BR><BR>So I essentially want to do:<BR><BR>SELECT * FROM usernames order by names , SELECT * from departments order by dept<BR><BR>You get the idea =)<BR><BR>Is this possible? If not does anyone know any good workarounds?<BR><BR>Thanks in advance,<BR><BR>Justin

  2. #2
    Stephan Zutterman Guest

    Default RE: Multiple SQL Statements

    I do not see what the problem really is. This is quite easy.<BR><BR>What you do is you define two recordset objects, one for the usernames and one for the departments.<BR><BR>Small example...<BR><BR>&#060;%<BR> Conn = &#039 connection string to your database<BR> Set rs = Server.CreateObject("ADODB.RecordSet")<BR> Set ps = Server.CreateObject("ADODB.RecordSet")<BR> SQLstmt1 = "SELECT * FROM usernames order by names"<BR> SQLstmt2 = "SELECT * from departments order by dept"<BR> rs.open SQLstmt1,conn,3,3<BR> ps.open SQLstmt2,conn,3,3<BR> &#039 build your select boxes<BR> rs.close<BR> ps.close<BR> conn.close<BR><BR>%&#062;<BR>

  3. #3
    Join Date
    Dec 1969
    Posts
    716

    Default RE: Multiple SQL Statements

    As they say .. it&#039s easy when you know how ;)<BR><BR>Thanks for the help - it&#039s working happily now.<BR><BR>Justin

  4. #4
    Join Date
    Dec 1969
    Posts
    538

    Default RE: Multiple SQL Statements

    Can anyone expand on the &#039build your select boxes&#039 part?


Posting Permissions

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