Easy Client Database ---- Tabular Data Control

zhaozj2021-02-12  191

Tabular Data Control (TDC): This is a simple DSO that provides access to formatted text files. That is, the data source provided by TDC is a text file that is formatted with a specified separator. It can be applied to all browsers above IE4.0, and he also created a simple database (such as PHP MySQL) that does not require server-side scripting, just simple application client scripts can be operated as JavaScript TDC. But if your browser is NS, then you have to install a plugin has got the same effect.

TDC application template:

.........

Like Applet, any Object must have parameters, TDC has approximately eight parameters, here I don't want to introduce one, I only introduce 5 important parameters:

1, DataURL: You want to read the path of the text, for example: c: /data.txt

2, Useheader: Get the column name of the data to output in the first line of the file

3, TextQualifier: Determine a specific symbol surrounded by your data, for example ~ zhaoweiwei ~, here is "~" as this symbol

4, FieldDelim: Symbols for dividing two adjacent data in a row

5, Rowdelim: Determine a symbol already indicates the end of a line, the default value is: Retail

For example, as follows:

// To read data file // Column name data is separated by "|" Separation

YourDataFile.txt content

Name | AGE ~ premshree pillai ~ | ~ 19 ~

Let's introduce the actual application and its advantages:

If I want to display a form in a web page to store my contact, but I don't want every time I increase the new content or modify the previous content, I will modify my web page, and this less content is also There is no need to use the database like the database, so the TDC method has become my own choice.

Remember to put your * .txt file and your web page (* .htm) file in the same directory, first build a txl.txt file (in accordance with the format above), as follows:

Name | AGE | Phone | QQ | Mail

~ Zhao Guan Nan ~| ~ 22~| ~ 1381303698~|~231312~| @ 2a@sina.com

~ Yang Xu ~|~22~|~1393023698 ~| ~ 122256312 ~| Yangx@sina.com

~ Han Hongli ~| ~ 23 ~| ~ 138136556~| ~8297312 ~|Hanghl@sina.com

Here I only record a few information, and I will not write more for the insight.

Then start building our web page (TDC_EX.HTM) as follows:

// DataSRC is the data source of the data to read, as starting with the start of the statement

Name:

Age:

Tel:

QQ:

Email:

// represents each column name, the first line of TXL.txt file

Finally, the results were obtained:

Name:

Age:

Phone:

QQ:

Email:

Zhao Guannan

twenty two

1381303698

231312

Zhaogn@sina.com

Yang Xu

twenty two

1393023698

12256312

Yangx@sina.com

Han Hongri

twenty three

138136556

8297312

Hanghl@sina.com

This way, if you want to add a new content just in txl.txt, you can display the top of the Web, save the application of the database, which also reflects the advantage of TDC.

转载请注明原文地址:https://www.9cbs.com/read-6198.html

New Post(0)
CopyRight © 2020 All Rights Reserved
Processed: 0.043, SQL: 9