The C form reads EXCEL and stores it in the SQL database
- 2020-12-19 21:09:29
- OfStack
This article shows an example of how the C# form reads EXCEL and stores it in the SQL database. Share to everybody for everybody reference. Specific implementation methods are as follows:
windows form has 1 Textbox1,2 buttons button1 and button2~ Press button1 to select excel file ~ press button2 for processing
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);
// Then do the data processing you need
}
Hopefully this article has helped you with your C# programming.