2+ sql statements within same asp

Results 1 to 3 of 3

Thread: 2+ sql statements within same asp

  1. #1
    Aku Guest

    Default 2+ sql statements within same asp

    Hayde,<BR><BR>Can anyone tell me how to distinct multiple SQL statements within one page? My idea is to use results from two or more queries to populate multiple drop menus within same form.

  2. #2
    Join Date
    Dec 1969
    Posts
    131

    Default RE: 2+ sql statements within same asp

    If i understand you clearly, this is an example of something that i have done so far through my quest of learning asp. I have approximately 4 drop-down boxes which consequently needs 4 SQL. You can have as many SQLs on one page just as long as you name your SQL differently eg. SQL1="SELECT..." SQL2="SELECT..." Similarly, upon executing your SQL, you have to set your Recordsets to different variables. Eg.<BR> set oRs1=DbObj.execute(SQL1) <BR> set oRs2=DbObj.execute(SQL2) <BR><BR>This is how my listboxes look. Like this........<BR><BR>&#060;Select NAME="Employee"&#062;<BR>&#060;%<BR> SQLEmployee="SELECT FName, MI, LName, People_ID FROM tblPeople ORDER BY LName, FName"<BR> set oRs1=DbObj.execute(SQLEmployee)<BR> DO WHILE NOT oRs1.EOF<BR> %&#062;<BR> &#060;OPTION VALUE=&#039&#060;%=oRs1("People_ID")%&#062;&#039<B R> &#060;% if (Form_E_ID = oRs1("People_ID")) then response.write " SELECTED" %&#062;<BR> &#062; &#060;!--Ends OPTION VALUE ---&#062;<BR> &#060;%=oRs1("FName") %&#062;&nbsp;&#060;%=oRs1("MI") %&#062;&nbsp;&#060;%=oRs1("LName") %&#062;<BR> &#060;/OPTION&#062;<BR> &#060;% oRs1.MoveNext %&#062;<BR> &#060;% Loop %&#062;<BR>&#060;/select&#062;<BR>&#060;/td&#062;<BR>&#060;/tr&#062;<BR>&#060;tr&#062;<BR> &#060;td align=right&#062;&#060;font face="Arial, Helvetica, Verdana" size="2"&#062;&#060;b&#062;Preparer Name:&#060;/b&#062;&nbsp;&#060;/font&#062;&#060;/td&#062;<BR> &#060;td&#062;<BR> &#060;Select NAME="Preparer"&#062;<BR> &#060;%<BR> SQLEmployee="SELECT FName, MI, LName, People_ID FROM tblPeople ORDER BY LName, FName"<BR> set oRs1=DbObj.execute(SQLEmployee)<BR> DO WHILE NOT oRs1.EOF<BR> %&#062;<BR> &#060;OPTION VALUE=&#039&#060;%=oRs1("People_ID")%&#062;&#039<B R> &#060;% if (Form_P_ID = oRs1("People_ID")) then response.write " SELECTED" %&#062;<BR> &#062; &#060;!--Ends OPTION VALUE ---&#062;<BR> &#060;%=oRs1("FName") %&#062;&nbsp;&#060;%=oRs1("MI") %&#062;&nbsp;&#060;%=oRs1("LName") %&#062;<BR>&#060;/OPTION&#062;<BR>&#060;% oRs1.MoveNext %&#062;<BR>&#060;% Loop %&#062;<BR>&#060;/select&#062;<BR>&#060;/td&#062;<BR>&#060;/tr&#062;

  3. #3
    Aku Guest

    Default RE: 2+ sql statements within same asp

    Thanks Audrey,<BR><BR>I thought solution would be along those lines. (I had done it with coldfusion before)<BR><BR>;) Aku<BR><BR>

Posting Permissions

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