C#窗体读取EXCEL存入SQL数据库

windows窗体上放了一个Textbox1,2个按钮button1和button2~按button1选择excel文件~按button2进行相关处理

Code Snippet

private  void button1_click(object sendeer,EventArgs e) 

       { 

           OpenFileDialog  openFiledialog1=new OpenFileDialog(); 

          openFileDialg1.filter="Excel文件|*.xls"; 

             openFileDialg1.ShowDialog(); 

             textBox1.Text=openFileDialog1.FileName; 

      } 

 private void button2_click(object sender, EventArg e) 

     { 

       DataSet dt=ReadExcel(textBox1.Text); 

   //然后进行您需要的数据处理 

        }

   

原文地址:https://www.cnblogs.com/gc2013/p/4226861.html