ASP. Aries Advanced Development Tutorial: Excel Import Single table configuration (top)

Source: Internet
Author: User

Objective:

With the popularization of ASP. Aries, just a little bit of leisure, quickly fill in the Excel Import function tutorial.

Excel import features, divided into four: single-table configuration (top), multi-table Advanced Configuration (middle), configuration rules (under), Code writing (external).

This article describes the single-table configuration feature.

1, configure the table header, the need to import the hook to hit.

For a formatted configuration (when you generate an Excel template, it also becomes a drop-down item, and when you import it back, it can also translate the drop-down in Chinese back to the value)

Description

Tick three, indicating import only imports three. Where the unique (key) is checked, the imported data is inserted according to the unique key (the presence is updated, does not exist). You can also tick multiple unique keys to make a composite (the default is: and relationship).
2. Export Template

When you click Export template on the page, automatically generated template files are automatically ejected according to the selected import options.

PS: If an import option is not checked (unless advanced import rules are configured), the import and export template two buttons are not displayed.

Description

The exported file name, which can be modified in the configuration maintenance item, is generated by default by the system based on the rules (description of the table name, or menu name).

Next, fill in the data in the template and then import to finish.

How does the system know which table to import?

On the list page: var dg = new AR. DataGrid ("V_sys_userlist", "Sys_user", "grid");
The second parameter is the table name: it determines the name of the action table to be added or deleted and imported.

Other instructions:

Of course, there are some problems with the example import here. Because the password stored in the database is encrypted, the password written to the user is definitely clear, so there is a lack of a cryptographic conversion. In this case, you need to complement the code: rewrite the method before the import, write a loop, the password is converted to dense data, the other unchanged. If you fill in the code, you can look at the following out of the code to write an article.

Results of the import:

If the import is successful, prompt:

If the import fails, you are prompted with an exception and the wrong Excel download file pops up:

The error message for each line is marked with the wrong Excel file:

Summarize:

Tasks that are completed by configuration in the configuration header are usually suitable for single-table imports and do not have complex transformations.

If it is a single table, but also requires a complex conversion, such as password encryption, is not a simple drop-down translation can handle the situation, you need to complement the code processing.

For complex insert configurations with multiple tables, take a look at the next article.

ASP. Aries Advanced Development Tutorial: Single-table configuration for Excel import (top)

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.