最近需要把Excel表格里面的数据导入到数据库里面,就研究了一下Excle,怎样把所有表单里面的数据读取出来,下面是代码:
private void button_leadIn_Click(object sender, EventArgs e)
{
OpenFileDialog ofd = new OpenFileDialog();
ofd.Filter = "Microsoft Excel files(*.xls)|*.xls;*.xlsx";//过滤一下,只要表格格式的
ofd.InitialDirectory = "c:\\";
ofd.RestoreDirectory = true;
ofd.FilterIndex = 1;
ofd.AddExtension = true;
ofd.CheckFileExists = true;
&nb