OleDbConnection conn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data  Source="+filename+";User ID=Admin;Password=;Extended properties=Excel 8.0");
    conn.Open();
     DataTable dt=conn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables,new object[] {null,null,null,"TABLE"});
     string eName="["+dt.Rows[0]["TABLE_NAME"].ToString ().Trim()+"]";

     OleDbCommand cmd = new OleDbCommand("insert into [ODBC;Driver=SQL Server;UID=sa;PWD=;Server=ck;DataBase=tb2;].gz select *,'"+DL_Y.SelectedItem.Text+"' as [year],'"+DL_M.SelectedItem.Text+"' as [month] from "+eName,conn);

相关文章:

  • 2021-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-02
  • 2021-09-07
  • 2022-02-06
  • 2021-07-09
猜你喜欢
  • 2021-10-12
  • 2021-12-23
  • 2022-01-01
  • 2021-09-26
  • 2021-11-29
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案