C # Forms How to read Excel and deposit SQL database

Source: Internet
Author: User

The example in this article describes how C # forms read Excel and deposit into SQL database. Share to everyone for your reference. The implementation method is as follows:

A textbox1,2 button is placed on a Windows Form button1 and button2~ Press button1 select Excel file ~ Press Button2 for related processing


The code is as follows:

private void Button1_Click (Object Sendeer,eventargs e)

{

OpenFileDialog openfiledialog1=new OpenFileDialog ();

openfiledialg1.filter= "Excel file |*.xls";

Openfiledialg1.showdialog ();

Textbox1.text=openfiledialog1.filename;

}

private void Button2_Click (object sender, EventArg e)

{

DataSet Dt=readexcel (TextBox1.Text);

And then do the data you need.

}

In addition to the Declaration, Running GuestArticles are original, reproduced please link to the form of the address of this article
C # Forms How to read Excel and deposit SQL database

This address: http://www.paobuke.com/develop/c-develop/pbk23190.html






Related Content C # Public method class instance for date format Conversion C # Determines if a string is a numeric type c#êμ?? 3ìdò?a?ú??? ˉμ?? ¨c# How to do multithreaded programming in Unity game development
C # Implementing taskbar notification window C # Loop statement collection and case study C # methods for reading parameters from the command line delegate introduction in C #

C # Forms How to read Excel and deposit SQL database

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.