Program | data | database | Show Introduction:] I am although halfway decent a few years of procedures, but I do not know whether they are a programmer. I recently helped friends to make a website, for the sake of cheap space, chose the asp+access server. Because I know very little about ASP, so really do a little tired, especially the background database management, there are a lot of tables need my daily maintenance. I found that for background data management, basically to the database for the operation of the check, I a table a table of the same operation, really unbearable. Check the Internet, there is a universal data display program, unfortunately there is no data editing function. So I have the idea of writing a generic function of my own. Below is my reference user * after the implementation.
[Design goal:]
1, the database display, edit, add, modify, and can be defined by the user selection.
2, the displayed field column can be user defined (display name can be customized)
3, the display format of the page to be defined by the user, which includes the number of records per page, footer, column width, table style (configured with formatting control CSS file)
4, the component interface, support multi-language (Chinese,eng,...), unfortunately has not yet time to achieve, is Chinese.
5. Support multiple Table Joint inquiry
[Lack of limits:]
The invocation parameter is complex, requires document support, and there are restrictions on the multiple-table federated query alias.
[Use Example:]
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<meta http-equiv=content-type content= "text/html; charset=gb2312 ">
<link href= "./style_cn.css" Type=text/css rel=stylesheet>
<title> Universal Database Display program </title>
<body bgcolor= "#66cccc" >
<%
' Multiple fields are represented by arrays
' DSN connection notation
' sconn = ' dsn=< database name >; UID=<DSN Account >; pwd=< Password > "
' Use a physical path to connect to an Access database
' sconn = ' dbq= ' & Server.MapPath ("<access the current file relative path >") &;D efaultdir=;D river={microsoft Access for the database file Driver (*.mdb)}; "
' Connect SQL Server notation
' sconn = ' provider=sqloledb; Persist Security Info=false; uid=< User name >; pwd=< password >;initial catalog=<sqlserver database name >;D ATA source=< data Server ip> "
Dim sconn, sTableName, Shidden, Sdisplay, Squery, Sorder, Itop, Ipagesize,seditcols,skey,srelation,scolwidth
sconn = "dbq=" & Server.MapPath ("Sample.") MDB ") &;D efaultdir=;D river={microsoft Access DRIVER (*.mdb)};
' sTableName = ' customer '
' Sdisplay = ' Contact person name | Contact Us | <a href= "" View.asp? customerid=$ customer id$ "" >$ contact person name $</a> Company Name | company, contact title | title, Address, City "
' Shidden = ' Customer ID '
' squery = ' Contact person name | Contact person, company name | company, contact title | title, City
' Sorder = ' Customer ID '
' Itop = 300
' Ipagesize = 2
' seditcols= ' 0,1,1,1,1 ' 0-not edit, 1-edit
' skey= ' customer (Customer ID); "
' Srelation= ' "
sTableName = "Customer,myorder"
Sdisplay = "myorder.custid| customer id|<a href=" "View.asp? customerid=myorder.custid$ "" > $CustName $</a>, lineid| line number, product| product, qty| quantity, amt| amount, dt| date, linenotes| remark "
Shidden = "CustName"
Squery = "myorder.custid| customer ID, product| product, dt| order Date"
Sorder = "Myorder.lineid"
Itop = 300
Ipagesize = 2
seditcols= "0,1,1,1,1,1,1" ' 0-not edit, 1-edit
Skey= "Myorder (Myorder.custid,lineid);"
srelation= "Myorder.custid=customer.custid"
Scolwidth= "20,40,60,60,60,60,60"
' Displaytable sconn, sTableName, Shidden, Sdisplay, Squery, Sorder, Itop, ipagesize
Dim objtable
Set objtable= New clsdispalytable
' Response. Write sconn & "<br>"
Objtable.settablepara sconn, sTableName, Shidden, Sdisplay, Squery, Sorder,srelation,skey
Objtable.seteditpara Seditcols, "", Scolwidth,true,true,true
Objtable.setpagepara 300,3
Response.Write "<table border=0 align=center cellspacing=0 cellpadding=0><tr><td bgcolor= #6699cc >"
Objtable.displaytable
Response.Write "</td></tr><table>"
' Pconn, Ptablenames, Phidden, Pdisplay, Pquery,porder,prelation,pkeys '
%>
Demo: http:www.qinych.com/caibing/test/test.asp
Article: <a href= "http://www.xurui.com/mypaper/Universal Database Display Program" > General database Display program article </a><br>
Sample ASP Program: <a href= "http://www.xurui.com/mypaper/Universal Database Display program/common.asp" >http://www.xurui.com/mypaper/ Universal Database Display Program/common.asp</a><br>
Sample database Address: <a href= "http://www.xurui.com/mypaper/Universal Database Display program/sample.mdb" >http://www.xurui.com/mypaper/ Universal Database Display Program/sample.mdb</a>
</body>
[Summary:] Although most of the functions have been completed, but there are many imperfect words, willing to ask a friend to advise.