private void m_btnView_Click(object sender, EventArgs e) { try { if (m_dataGridViewList.SelectedRows.Count > 0) { string mTreeView = Main.ms_strDeviceName.ToString(); string strConn = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=..\\..\\mdb\\HistoryData.mdb"; string strQuery = "Select * From {0} where [Test_StartDt]='{1}'"; strQuery = string.Format(strQuery, mTreeView, m_dataGridViewList.Rows[m_dataGridViewList.CurrentRow.Index].Cells[1].Value.ToString()); OleDbConnection conn = new OleDbConnection(strConn); if (m_dataGridViewList.Rows[m_dataGridViewList.CurrentRow.Index].Cells[0].Value.ToString() == "2") { conn.Open(); OleDbCommand cmd = new OleDbCommand(strQuery, conn); OleDbDataReader reader = cmd.ExecuteReader(); if (reader.Read()) { ms_objOnlineResultEx.m_strInterval = reader[6].ToString(); ms_objOnlineResultEx.m_strTOC = reader[19].ToString(); ms_objOnlineResultEx.m_strIC = reader[20].ToString(); ms_objOnlineResultEx.m_strTestNum = reader[5].ToString(); ms_objOnlineResultEx.m_strTestDate = reader[6].ToString(); ms_objOnlineResultEx.m_strDeviceName = Info.getDeviceName(); ms_objOnlineResultEx.m_strTestOperate = reader[8].ToString(); ms_objOnlineResultEx.m_strChannelSum = reader[9].ToString(); ms_objOnlineResultEx.m_strTestTimes = reader[15].ToString(); } ViewOnlineReport objonline = new ViewOnlineReport(); objonline.Show(); conn.Close(); } if (m_dataGridViewList.Rows[m_dataGridViewList.CurrentRow.Index].Cells[0].Value.ToString() == "1") { conn.Open(); OleDbCommand cmd = new OleDbCommand(strQuery, conn); OleDbDataReader reader = cmd.ExecuteReader(); if (reader.Read()) { ms_objOfflineResultEx.m_strInterval = reader[6].ToString(); ms_objOfflineResultEx.m_strCodeName = reader[5].ToString(); ms_objOfflineResultEx.m_strCodeType = reader[4].ToString(); if (reader[17].ToString() == "1") { ms_objOfflineResultEx.m_strSampleWay = "auto"; } else { ms_objOfflineResultEx.m_strSampleWay = "manual"; } ms_objOfflineResultEx.m_strDeviceName = Info.getDeviceName(); ms_objOfflineResultEx.m_strSamples = reader[14].ToString(); ms_objOfflineResultEx.m_strTester = reader[8].ToString(); ms_objOfflineResultEx.m_strTestTimes = reader[15].ToString(); ms_objOfflineResultEx.m_strTestSumTimes = reader[18].ToString(); ms_objOfflineResultEx.m_strStartBottle = reader[16].ToString(); ms_objOfflineResultEx.m_strAveTOC = reader[11].ToString(); ms_objOfflineResultEx.m_strAveIC = reader[12].ToString(); ms_objOfflineResultEx.m_strAveCon = reader[13].ToString(); ms_objOfflineResultEx.m_strTOC = reader[19].ToString(); ms_objOfflineResultEx.m_strIC = reader[20].ToString(); ms_objOfflineResultEx.m_strCON = reader[7].ToString(); } ViewOfflineReport objonline = new ViewOfflineReport(); objonline.Show(); conn.Close(); } if (m_dataGridViewList.Rows[m_dataGridViewList.CurrentRow.Index].Cells[0].Value.ToString() == "3") { conn.Open(); OleDbCommand cmd = new OleDbCommand(strQuery, conn); OleDbDataReader reader = cmd.ExecuteReader(); if (reader.Read()) { ms_objConResultEx.m_strInterval = reader[6].ToString(); ms_objConResultEx.m_strCodeName = reader[5].ToString(); ms_objConResultEx.m_strCodeType = reader[4].ToString(); if (reader[17].ToString() == "1") { ms_objConResultEx.m_strSampleWay = "auto"; } else { ms_objConResultEx.m_strSampleWay = "manual"; } ms_objConResultEx.m_strDeviceName = Info.getDeviceName(); ms_objConResultEx.m_strSamples = reader[14].ToString(); ms_objConResultEx.m_strTester = reader[8].ToString(); ms_objConResultEx.m_strTestTimes = reader[15].ToString(); ms_objConResultEx.m_strTestSumTimes = reader[18].ToString(); ms_objConResultEx.m_strStartBottle = reader[16].ToString(); string strTOC = reader[19].ToString(); string strIC = reader[20].ToString(); string strCon = reader[7].ToString(); ms_objConResultEx.m_strRwTOC = strTOC.Split(',')[0].ToString(); ms_objConResultEx.m_strRw = strTOC.Split(',')[6].ToString(); ms_objConResultEx.m_strRs = strTOC.Split(',')[13].ToString(); ms_objConResultEx.m_strRss = strTOC.Split(',')[20].ToString(); ms_objConResultEx.m_strResponseRate = strIC.Split(',')[0].ToString(); } ViewConReport objViewConReport = new ViewConReport(); objViewConReport.Show(); conn.Close(); } } } catch (Exception ex) { utils.loghelp.log.Error(ex.Message, ex); MessageBox.Show("Exception:" + ex.ToString(), "Tips"); } }