From 161b7c04d1c509a81f91fd932f2030705a40cde0 Mon Sep 17 00:00:00 2001 From: gaofei1985 <181547018@qq.com> Date: Wed, 8 Apr 2026 10:17:31 +0800 Subject: [PATCH] 1 --- .../HSSE/EduTrain/TrainRecordIn.aspx.cs | 50 +++++++++---------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/SGGL/FineUIPro.Web/HSSE/EduTrain/TrainRecordIn.aspx.cs b/SGGL/FineUIPro.Web/HSSE/EduTrain/TrainRecordIn.aspx.cs index b32bcf94..c26322a2 100644 --- a/SGGL/FineUIPro.Web/HSSE/EduTrain/TrainRecordIn.aspx.cs +++ b/SGGL/FineUIPro.Web/HSSE/EduTrain/TrainRecordIn.aspx.cs @@ -127,33 +127,33 @@ try { viewTrainRecordDetails.Clear(); - string oleDBConnString = String.Empty; - oleDBConnString = "Provider=Microsoft.Jet.OLEDB.4.0;"; - oleDBConnString += "Data Source="; - oleDBConnString += fileName; - oleDBConnString += ";Extended Properties=Excel 8.0;"; - OleDbConnection oleDBConn = null; - OleDbDataAdapter oleAdMaster = null; - DataTable m_tableName = new DataTable(); - DataSet ds = new DataSet(); + //string oleDBConnString = String.Empty; + //oleDBConnString = "Provider=Microsoft.Jet.OLEDB.4.0;"; + //oleDBConnString += "Data Source="; + //oleDBConnString += fileName; + //oleDBConnString += ";Extended Properties=Excel 8.0;"; + //OleDbConnection oleDBConn = null; + //OleDbDataAdapter oleAdMaster = null; + //DataTable m_tableName = new DataTable(); + //DataSet ds = new DataSet(); - oleDBConn = new OleDbConnection(oleDBConnString); - oleDBConn.Open(); - m_tableName = oleDBConn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null); + //oleDBConn = new OleDbConnection(oleDBConnString); + //oleDBConn.Open(); + //m_tableName = oleDBConn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null); - if (m_tableName != null && m_tableName.Rows.Count > 0) - { - m_tableName.TableName = m_tableName.Rows[0]["TABLE_NAME"].ToString().Trim(); - } - string sqlMaster; - sqlMaster = " SELECT * FROM [" + m_tableName.TableName + "]"; - oleAdMaster = new OleDbDataAdapter(sqlMaster, oleDBConn); - oleAdMaster.Fill(ds, "m_tableName"); - oleAdMaster.Dispose(); - oleDBConn.Close(); - oleDBConn.Dispose(); - - AddDatasetToSQL(ds.Tables[0]); + //if (m_tableName != null && m_tableName.Rows.Count > 0) + //{ + // m_tableName.TableName = m_tableName.Rows[0]["TABLE_NAME"].ToString().Trim(); + //} + //string sqlMaster; + //sqlMaster = " SELECT * FROM [" + m_tableName.TableName + "]"; + //oleAdMaster = new OleDbDataAdapter(sqlMaster, oleDBConn); + //oleAdMaster.Fill(ds, "m_tableName"); + //oleAdMaster.Dispose(); + //oleDBConn.Close(); + //oleDBConn.Dispose(); + DataTable dt = NPOIHelper.ExcelToDataTable1(fileName); + AddDatasetToSQL(dt); } catch (Exception ex) {