当前位置:数据库 > SQLServer >>

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); 
   //然后进行您需要的数据处理 
        } 

    
补充:软件开发 , C# ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,