This code is used to import and export datatable files in XML, Excel, and CSV files. Record the code for future use.
Be sure to import the Excel file and add a reference to Microsoft. Office. InterOP. Excel 11.0.
Default. aspx. CS File
Using system;Using system. Collections. Generic;Using system. LINQ;Using system. Web;Using system. Web. UI;Using system. Web. UI. webcontrols;Using system. Data. sqlclient;Us
Requirement: Import multiple NTS that meet the conditions in the oracledata database into a csv1_file and store them with the table name. CSV as the file name.
Implementation: It is implemented through the UTL_FILE function in the stored procedure. The exported csv file is placed in the directory created in advance.
Usage: Use the following command to pre-execute the SQL script
SELECT 'exec SQL _to_csv (''s
Import CSV:
Copy Code code as follows:
Load data infile '/test.csv ' into table table_name
Fields terminated by ', ' optionally
Enclosed by ' "' escaped by '"
Lines terminated by ' \ r \ n '
Ignore 1 lines;
Guide CSV:
Copy Code code as follows:
SELECT * into outfile '/test.csv '
FIELDS terminated by ', ' optionally
Enclosed by ' "'
LINES terminated by ' \ n '
from table_name
,out_file_
Name, ' W '); Count_num: = 0; while Count_num /* ====================
Fourth step: Create the output directory and authorize the relevant user
==================== */
Create or replace DIRECTORY MYDIR as ' d:\tmp\ ';
GRANT read,write on DIRECTORY MYDIR to Wenglin;
/* ====================
Step Fifth: Command line execution, view output file To see the command line print results, execute: Set serveroutput on
====================
*
/exec export_to_csv (' MYDIR '); Additional instruct
Background management system is always millions of data export, using Excel export can not be implemented at all, Excel only supports 65536,2007 and 2010 is 1048576, so no matter which can not meet the requirements, CSV to meet the requirements, do not limit the number of records, But a lot of data if the one-time processing of the
Reprint: http://blog.csdn.net/huyanping/article/details/7068356Often encounter need to export data from the database to Excel file, with some open-source class library, such as Phpexcel, it is quite easy to implement, but the support of a lot of data is not good, it is easy to reach the PHP memory usage limit. The method here is to use the Fputcsv write CSV file method, directly to the browser output Excel
When writing a program, you need to import a large amount of data into the database. for example, test scores and phone books are generally stored in excel. when writing a program, you need to import a large amount of data into the database, for example, exam scores and phone books are generally stored in excel. in this case, we can export the excel file to a csv file and then import the data to the databas
This article describes how to export mysql data to csv files using the specified encoding in php. it involves php's skills in querying mysql and operating csv files. it has some reference value, for more information about how to export mysql data to a csv file, see the examp
This article describes how to export mysql data to csv files using the specified encoding in php. it involves php's skills in querying mysql and operating csv files. it has some reference value, for more information about how to export mysql data to a csv file, see the examp
Import and Export csv files
In work, you need to import csv file data to the database or export the database data as a csv file. The following is my simple implementation.
1
For
Sometimes, when writing a program, the background requires that a large amount of data be imported into the database. For example, the computer examination result query and phone book data are generally stored in excel, in this case, we can export the data to a csv file, and then use the following program to import data to the database in batches in the background.
The following is only the main program
To export data to Excel files into scientific notation questions:
Analysis: The CSV file exported by the program, when the field has a relatively long number of fields exist, in the use of Excel software to view the CSV file will become the form of scientific and technological law.In fact, this question is not related to what language to
Export csv data within three months in PHP, as shown in the following figure:
I want to figure out the first day of the month to the last day of the month three months ago.
What should I do if I can get the first day of three months?
Reply to discussion (solution)
Select * fromtbl_namewhere date> = date_format (subdate (now (), INTERVAL 3 month), '% Y-% m-% d ')OrSelect * fromtbl_namewhere date> = date
// Export protected void btnoutput_click (Object sender, eventargs e) {// role initialroles (); datatable dt = dbclass. getdatatable (string. format (@ "select * from {0} order by Sn DESC", view (where); stringwriter Sw = new stringwriter (); // The 4s store cannot see the relevant fields such as the Headquarters price if (umrolenames. contains ("4 s") {Sw = get4sstr (DT);} else {Sw = getadminstr (DT);} SW. close (); response. addheader ("content-disp
MySQL imports and exports CSV files bitsCN.com
MySQL provides a tool for importing and exporting databases. However, sometimes we only need to import and export data from a single table, such as importing and exporting CSV files. in this case, you can use the MySQL automatic command to import and export data.
The
1. Import data from DataGridView into a CSV file
Public static bool dataGridViewToCSV(DataGridView dataGridView)
{
If (dataGridView.Rows.Count == 0)
{
MessageBox.Show("No data to export!", "Prompt", MessageBoxButtons.OK, MessageBoxIcon.Information);
Return false;
}
SaveFileDialog saveFileDialog = new SaveFileDial
Transferred from: http://codingstandards.iteye.com/blog/604541The sample SQL statements for exporting CSV format data in MySQL are as follows: Select from '/tmp/test.csv', ' " "'"'\ r \ n'The sample SQL statements for importing CSV format data in MySQL are as follows: ' /tmp/test.csv ' into table Test_info ' , ' ' " ' ' " ' '\ r \ n';nbsp;The most critical part of this is the format parameter.' , ' '
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.