<%
On Error Resume Next  
 Set DBC= Server.CreateObject("ADODB.Connection")
 CnString ="Provider=SQLOLEDB.1;Server=203.95.191.21;Database=fruit_hv;UID=sa;PWD="
 DBC.Open  CnString
 Set CmdObj = Server.CreateObject("ADODB.Command")
 Set CmdObj.ActiveConnection = DBC
 Set RS = Server.CreateObject("ADODB.Recordset")    
 Set RS1 = Server.CreateObject("ADODB.Recordset")    
 call DBError
%>
<%
function DBError
if Err.Number<>0 then
  Response.Write "<p>無法連接資料庫、順利取得資料或執行SQL敘述"
  Response.Write "<p>原因：" & Err.description
  Response.Write "<p>錯誤來源：" & Err.Source
end if 
DBError=Err.Number
end function


Sub Display_Page(RS,page,porq) 
  RS.AbsolutePage = page 
  Response.Write "<CENTER><TABLE BORDER=1><TR BGCOLOR=#00FFFF>" 
  Response.Write "<TD>訂購編號</TD>" 
  For i=0 to RS.Fields.Count-2 
     Response.Write "<TD>" & RS(i).Name & "</TD>" 
  Next 
For i = 1 to RS.PageSize 
	if RS.EOF then	 
		Exit For  
	end if	 
       Row = "<TR BGCOLOR=#FFFF00> <TD Align=center bgcolor=#ffaaff>"
       Row=Row& "<a href='buy.asp?prod_num="&RS(0)&"&prod_name="&Trim(RS(2))&"&price="&RS(3)
       Row=Row& "&sup_code="&RS(5)&"&ToPage="&page&porq&"'>" & RS.AbsolutePosition & "</TD>" 
       For j=0 to RS.Fields.Count-3 
        Row = Row & "<TD>" & Rs(j) & "</TD>"   
       Next 
       Row=Row & "<TD> <a href='" & RS(j) & "'>" & RS(j) &"</TD></a>" 
       Response.Write Row & "</TR>" 
       RS.MoveNext  
Next 
Response.Write "</TABLE></CENTER>" 
End Sub 
 
%>

