按另一个数据库中的值排序Recordset

时间:2014-10-30 08:50:14

标签: asp-classic

我有一个包含零件号信息的数据库,例如部件号和数量,我连接到此数据库,然后循环部件号记录集,以显示单独数据库中的位置。如何订购HTML表格,以便按位置排序输出?

Dim adoCon             
Dim SQL
Dim Recordset2
Dim oddsevens



SQL= "SELECT * FROM returnparts where RMAid='" & rmaid &"' order by partnumber"
 Set adoConreturns = Server.CreateObject("ADODB.Connection")%>
<!--#include file="includes/adoConreturns.inc"-->
<%Set recordset2 = adoConRETURNS.Execute(SQL)

If recordset2.eof then
   no_rows2 = True
      End If

If no_rows2 Then
response.write "No Parts to Return"
Else    
Dim lastValue, theColor
lastValue  = ""
theColor = "#b4def5"


       while not recordset2.eof


If Cstr(lastValue) <> Cstr(recordset2.fields("returnpartid")) Then
If theColor = "#DDF4FF" Then
    theColor = "#ffffff"
Else
    theColor = "#DDF4FF"
End If
%>
          <%End If%>

<tr bgcolor="<%=theColor%>">

            <td height="12"><span class="style11 style1">

            <a href="javascript:popUp2('partedit.asp?RMAid=<% response.write(rmaid)%>&partno=<% response.write recordset2.fields("partnumber")%>&returnpartid=<%response.write recordset2.fields("returnpartid") %>')"><%Response.write recordset2.fields("partnumber") %></a></span></td>
            <td valign="middle"><span class="style11 style1">
            <%Response.write recordset2.fields("qtyreceived")%>
            </span>                  <span class="style1">
            <label></label>                
            <label></label>
            </span></td>
            <td valign="middle"><span class="style1">
              <%


       Set cnnSimple = Server.CreateObject("ADODB.Connection")
cnnSimple.Open "Provider=SQLOLEDB.1;User ID= Source=DATASERVER"

sqlmam = "SELECT Location FROM Locations WHERE PART =  '" & recordset2.fields("partnumber") &"' Order By Location"
set rsmam = Server.CreateObject("ADODB.RecordSet")
rsmam.Open sqlmam, cnnSimple, 0, 1, 1
norows4 ="clear" 
if rsmam.eof then
norows4="norecords"
else
TheArray = rsmam.Getrows
End If

rsmam.close
set rsmam = nothing
cnnSimple.close
Set cnnSimple = nothing

IF norows4 ="norecords" then
       response.write("-")
       else
       For X = 0 to Ubound(TheArray,2)
       Response.write (TheArray(0,x) )
       response.write (" ")
       next
       end if
       %>        

</td>
  </tr>


          <%
    lastValue  = recordset2.fields("returnpartid") 

recordset2.MoveNext
 Wend %>

          <%
    End If%>
          <%
Set Recordset2 = nothing%>

0 个答案:

没有答案