使用ASP、VB和XML建立运行于互联网上的应用程序(2) 在实际的编程过程中,你们应当使用一些方法使应用程序更加有高效性。你可以把ASP中的关于取得数据的代码端搬到一个COM应用程序中去然后创建一个XSLT变换来显示返回的数据。好,我不多说了,现在你所要做的就是试一试吧! Option Explicit Private RCommands As Recordset Private RCustomers As Recordset Private RCust As Recordset Private sCustListCommand As String Private Const dataURL = "http://localhost/XHTTPRequest/getData.asp" Private arrCustomerIDs() As String Private Enum ActionEnum VIEW_HISTORY = 0 VIEW_RECENT_PRODUCT = 1 End Enum Private Sub dgCustomers_Click() Dim CustomerID As String CustomerID = RCustomers("CustomerID").Value If CustomerID <> "" Then If optAction(VIEW_HISTORY).Value Then Call getCustomerDetail(CustomerID) Else Call getRecentProduct(CustomerID) End If End If End Sub Private Sub Form_Load() Call initialize Call getCustomerList End Sub Sub initialize() ' 从数据库返回命令名和相应的值 Dim sXML As String Dim vRet As Variant Dim F As Field sXML = "<?xml version=""1.0""?>" sXML = sXML & "<command><commandtext>Initialize</commandtext>" sXML = sXML & "<returnsdata>True</returnsdata>" sXML = sXML & "</command>" Set RCommands = getRecordset(sXML) Do While Not RCommands.EOF For Each F In RCommands.Fields Debug.Print F.Name & "=" & F.Value Next RCommands.MoveNext Loop End Sub Function getCommandXML(command_name As String) As String RCommands.MoveFirst RCommands.Find "command_name='" & command_name & "'", , adSearchForward, 1
|