Bcp imports local txt text to remote SQL server. Local SQL server is not installed

Source: Internet
Author: User
The last written bcp import was performed remotely in a SQL server environment. Because the project requires me to modify the Import and Export Process for large databases, the customer requires that the environment be a combination of web server, file server, and database server. SQL Server cannot be installed on the web server, and a large number

The last written bcp import was performed remotely in a SQL server environment. Because the project requires me to modify the Import and Export Process for large databases, the customer requires that the environment be a combination of web server, file server, and database server. SQL Server cannot be installed on the web server, and a large number

The upload and bcp. rll files are copied to the web server. The following files are stored in the compant folder of the project:

Using System;
Using System. Data;
Using System. Data. SqlClient;
Using System. Diagnostics;
Code
Private void Page_Load (object sender, System. EventArgs e)
{
// Place user code here to initialize the page
Process p = new Process ();
P. StartInfo. FileName = Server. MapPath ("compant/bcp.exe ");
P. StartInfo. UseShellExecute = false;
// @ Must be added. Otherwise, special characters will be automatically filtered out.
P. StartInfo. Arguments = @ "Test .. BcpTest in D: emp.txt-S-Usa-P1-c-t ,";
Try
{
P. Start ();
P. WaitForExit ();
P. Close ();
}
Catch
{}
}

Http://cndsn.cnblogs.com/archive/2006/05/22/406279.html

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.