ASP. NET-based data migration method dbf upload

Source: Internet
Author: User
Tags dbase

1 Introduction

In recent years, many colleges and universities in China have gradually established network infrastructure and built some application systems. However, due to lack of understanding of the overall structure of the Digital Campus, there is a lack of unified planning for system building. The existing systems are separated from each other, and information and resources cannot be shared, however, some systems are highly integrated, difficult to maintain and upgrade, and the network basic service platform is out of touch with the application system.

In the construction of a digital campus, the concept of URP (University Resource Plan) has solved problems such as information sharing. By establishing a unified database and developing unified information standards, URP enables the integration of various information systems in a loosely coupled manner, ensuring data consistency, reliability, availability, and security. Historical data in the original system can be imported to the new system through data migration. But in the process of data migration, new problems also emerge.

2. Problems faced by data migration

Currently, most of the information systems are developed using large databases such as SQL Server, Oracle, and Sybase. Most database systems in the "digital campus" construction also use these databases. Dbase, FoxBASE, and FoxPro are widely used database development software in China in recent years. Many management systems in colleges and universities still use this DBF format. With the use of the new system, how to import a large amount of valuable data accumulated in the original system over the years into the new system becomes a problem to be solved, that is, we will face how to migrate the original data to the new system database.

3. Solution

The main purpose of a unified database is to achieve data sharing and ensure data consistency. However, whether it is a new information system or an original information system, the business of each system has not undergone any essential changes. Therefore, the structure and data of the database can be basically the same, but the database platform is different. In addition, the DTS (Data Transformation Services) tool provided by SQL Server also includes the function of importing old format database files such as Dbase, FoxBASE, and FoxPro to SQL database.

Therefore, ASP. the database operation functions provided by. NET can be programmed with SQL statements to replace all DTS functions, so that a large amount of historical data can be migrated to the new database system.

4. Design and Implementation

Taking the National Employment Management System for college graduates as an example, we will describe how to implement the data migration function.

The original system is a stand-alone software uniformly used by the Ministry of Education. It is written in FoxPro and stored in DBF format. The new system adopts the B/S structure, and uses ASP. NET to write and SQL Server database to store data.

You need to solve the following problems when writing a program for data migration:

(1) The original system data file is in the DBF format. in SQL Server, the folder where the DBF file is located is considered a database and the DBF file is considered a data table.

(2) During data migration, DBF Files may be stored on the client and SQL Server databases on the Server. Therefore, you must upload the DBF Files to the Server before performing operations.

(3) Based on your business needs, the data migration function should include the initial migration, data appending, and data overwriting functions.

4.1 DBF File Upload

Traditional data files in DBF format are generally small files. Therefore, you can use the Upload Component provided by ASP. NET. The file type to be uploaded is limited to. DBF format. The upload function code is as follows:

// Determine whether the file size is 0

If (File1.PostedFile. ContentLength> 0)

{

String fileExt = Path. GetExtension (File1.

PostedFile. FileName). ToLower ();

// Determine whether the file is in DBF format

If (fileExt! = ". Dbf ")

{

// Error message

Label1.Text = "only files in dbf format can be uploaded !! ";

}

// Valid non-empty dbf File

Else

{

// Specify the upload directory

String filepath = Server. MapPath ("Data /");

// Upload to the specified directory

File1.PostedFile. SaveAs (filepath +

"Student. dbf ");

// Perform related data migration operations

......

}

}

Else

{

// Error message

Label1.Text = "the number of uploaded file bytes is 0 !! ";

}

  • Three pages in total:
  • Previous Page
  • 1
  • 2
  • 3
  • Next Page

Related Article

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.