Common data management and services using pure HTML

Source: Internet
Author: User
Tags array count end sql server string version xsl

use pure HTML for common data management and services. However, in order to collect data, you need a data repository. To avoid many of the problems with the database server, you can collect the data in XML. Here is the basic structure of our project:





I initially limited the data to first name,last name and middle. The basic idea behind this page is that the user information is available on this page. After the user's information needs are met, the process must be forwarded to the next logical collection step. To make things easier, I'll wrap the user functionality into an ASP class.

Function COALESCE (Vvar, Valt)
If vval = "" or VarType (vval) = 1 Or VarType (vval) = 0 Then
COALESCE = Valt
Else
COALESCE = Vval
End If
End Function

Class Cuser
Private M_sql, M_dom

Public Property Get DOM ()
Set DOM = M_dom
End Property

Public Sub Saveuser ()
M_sql.save "Save_user", M_dom
End Sub

Public Function Validate ()
M_dom.loadxml "" & M_sql.validateuser (m_dom) & ""
If not M_dom.selectsinglenode ("//error") are nothing Then
Validate = False
Else
Validate = True
End If
End Function

Private Sub Collectdata (DOM, ocollection)
Dim nitem, node, Parent_node, N, SKey
For nitem = 1 to Ocollection.count
SKey = Ocollection.key (nitem)
Set Parent_node = Dom.selectsinglenode ("//" & SKey & "S")
If not Parent_node are nothing Then
For n = 1 to Ocollection (SKey). Count
Set node = Parent_node.selectsinglenode (SKey & _
"[String (.) = ' "&
Ocollection (SKey) (n) & "']")
If node is nothing Then
Set node = dom.createnode (1, SKey, "")
Set node = parent_node.appendchild (node)
End If
Node.text = COALESCE (Ocollection (SKey) (n), "")
Next
Else
Set node = Dom.selectsinglenode ("//" & SKey)
If not node are nothing Then _
Node.text = COALESCE (Ocollection (SKey), "")
End If
Next
End Sub

Private Sub Class_Initialize ()
Set M_sql = New csql
Set m_dom = Server.CreateObject ("MSXML2. DOMDocument ")
M_dom.async = False
If VarType (Request ("txtuserxml") = 0 Or Request ("txtuserxml") = "" Then
M_dom.loadxml Request ("Txtuserxml")
Else
M_dom.load "" & Server.MapPath ("User.xml") & ""
End If
Collectdata M_dom, Request.Form
Collectdata M_dom, Request.QueryString
End Sub

Private Sub Class_Terminate ()
Set M_sql = Nothing
Set M_dom = Nothing
End Sub

End Class

Class Csql
Private M_dal, M_stream

Public Function Save (Sstoredproc, ODOM)
' adVarChar = 200
M_dal. RUNSP Array (M_DAL.MP ("@xml_param", MB, 8000, odom.xml))
End Function

Public Function ValidateUser (ODOM)
Set M_stream = M_dal. Runspreturnstream ("Validate_user", Array (_
M_DAL.MP ("@xml_param", 8000, Odom.xml))
ValidateUser = M_stream.readtext (-1)
M_stream.close
End Function

Private Sub Class_Initialize ()
Set M_dal = Server.CreateObject ("Mypkg.mydal")
M_dal. Getconnection "Some connection string"
Set M_stream = Server.CreateObject ("ADODB. Stream ")
End Sub

Private Sub Class_Terminate ()
Set M_dal = Nothing
Set M_stream = Nothing
End Sub

End Class
The Csql class is built based on a data access layer (M_dal) component Mypkg.mydal. This component is based on the Fitch and Mather Dal components, which can be found from MSDN. This allows us to build a bridge with your code in SQL Server.


When the Cuser object is initialized, it collects the request data and uses the Collectdata () child function to place the collected data in a corresponding node in Userdom. (The code I don't explain anymore because it's pretty easy to understand itself.) After the data has been collected (or not collected), we will use XSL to transform the data content into a layout.


Version= "1.0" >



*information in red is required







red
black


The Name:


select= "First_Name"/>





red
black


MI:








red
black


Last Name:


select= "Last_Name"/>

ver

Total 2 page: previous 1 [2] Next page



Related Article

Alibaba Cloud 10 Year Anniversary

With You, We are Shaping a Digital World, 2009-2019

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.