A method of data migration based on asp.net dbf upload

Source: Internet
Author: User
Tags dbase file upload

1 Introduction

In recent years, many universities in China have gradually established network infrastructure and constructed some application systems. However, due to the lack of understanding of the overall structure of the digital campus, there have been systematic construction, lack of unified planning, fragmented systems, information and resources can not be shared, and some systems are too high integration, maintenance and upgrade difficulties, network basic service platform and application system disjointed and so on.

In the construction of digital campus, the concept of URP (University Resource plan) solves the problem of information sharing well. Urp through the establishment of a unified database, the development of unified information standards, so that all kinds of information systems in a loosely coupled way to ensure the consistency of data, reliability, availability and security. The historical data in the original system can be imported into the new system through data migration. But in the process of data migration, new problems follow.

2 problems faced by data migration

At present, most of the development of information system is the use of SQL Server, Oracle, Sybase and other large databases, "digital campus" in the construction of the database system is mostly used in these kinds of databases. However, dBASE, FoxBASE, FoxPro are widely used in our country in recent years, there are still many management systems in the university using this DBF format database. With the use of the new system, the large amount of valuable data accumulated over the years in the original system has become a problem to be solved, that is, how to migrate the original data into the new system database.

3 Solution Ideas

The main purpose of the consolidated database is to realize data sharing and ensure the consistency of data. But whether it is the new information system, or the original information system, the business itself does not change in essence. Therefore, in the database structure to the data, can be maintained basically consistent, but the use of the database platform is different. In addition, the DTS (Data Transformation Services) tool provided by SQL Server itself also includes the ability to import old format database files, such as dBASE, FoxBASE, FoxPro, into the SQL database.

Therefore, according to the actual business demand, using the database operation function provided by ASP.net and programming with SQL statement, it can replace all the functions of DTS, and realize a great deal of historical data migrating to the new database system.

4 Design and implementation

Taking the National College graduate Employment Management system as an example, the paper illustrates how to realize the data migration function.

The original system for the Ministry of Education Unified use of stand-alone version of software, the use of FoxPro, and the use of DBF format files to store data. The new system uses B/s structure, uses asp.net to write and SQL Server database to store data.

The following issues need to be addressed in the process of writing a program for data migration:

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

(2) in the process of data migration, DBF files may be stored in the client, SQL Server database on the server side, which requires the DBF file upload to the server side before operation.

(3) According to the user's business needs, the data migration function should include the initial migration, append data, overwriting data and so on.

4.1 dbf File Upload

The traditional DBF format data file, the general file volume is small, so the use of asp.net provided by the upload component. For the upload file type, limit to. DBF format. To upload the Student basic information table STUDENT.DBF as an example, the upload function code is as follows:

Determine if the file size is 0

if (file1.postedfile.contentlength>0)


String Fileext=path.getextension (File1.

Postedfile.filename). ToLower ();

Determine if the DBF format file

if (fileext!= ". dbf")


Error prompt

label1.text= "only upload dbf format file!!";


Valid non-empty dbf file



Specify upload Directory

String Filepath=server.mappath ("data/");

Upload to the specified directory

File1.PostedFile.SaveAs (filepath+


Perform related data migration operations






Error prompt

Label1.text= "The number of bytes uploaded file is 0!!";


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.