void dealOnline(string sLine)
        {
            ConfigHis m_objConfigHis = new ConfigHis();

            char[] parsChar = { ',' };
            m_objConfigHis.m_strCodeType   = sLine.Split(parsChar)[1].ToString();
            m_objConfigHis.m_strCodeName   = sLine.Split(parsChar)[2].ToString();
            m_objConfigHis.m_strStartTime  = sLine.Split(parsChar)[3].ToString();
            m_objConfigHis.m_strLsampleNum = sLine.Split(parsChar)[4].ToString();
            m_objConfigHis.m_strOperator   = sLine.Split(parsChar)[5].ToString();

            int nTemp = Convert.ToInt32(sLine.Split(parsChar)[4].ToString());

            for (int i = 0; i < nTemp * 3; i = i + 3)
            {
                m_objConfigHis.m_strTOCValue = m_objConfigHis.m_strTOCValue + sLine.Split(parsChar)[(6 + i)].ToString() + ",";
                m_objConfigHis.m_strTCValue  = m_objConfigHis.m_strTCValue + sLine.Split(parsChar)[6 + i + 1].ToString() + ",";
                m_objConfigHis.m_strConduct  = m_objConfigHis.m_strConduct + sLine.Split(parsChar)[6 + i + 2].ToString() + ",";
            }

            string strConnection = "Provider=Microsoft.Jet.OLEDB.4.0;  Data Source=..\\..\\mdb\\HistoryData.mdb";
            string strDBInfo     = String.Format("insert into {0} ([CodeType],[CodeName],[Test_StartDt],[Test_EndDt],[Test_OprationName],[Channlesum],[OnlinestFlag],[AveTOCValue],[AveTCValue],[AveConduct],[LsampleNum],[Htest_testimes],[Start_Bott],[SampleWay],[TOCValue],[TCValue],[Conduct]) values ('{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}','{15}','{16}','{17}')",
                                                 TOCTest.Main.ms_strDeviceName, m_objConfigHis.m_strCodeType,
                                                 m_objConfigHis.m_strCodeName, m_objConfigHis.m_strStartTime,
                                                 m_objConfigHis.m_strEndTime, m_objConfigHis.m_strOperator,
                                                 m_objConfigHis.m_strChannlesum, m_objConfigHis.m_stronlinestflag,
                                                 m_objConfigHis.m_strAveTOCValue, m_objConfigHis.m_strAveTCValue,
                                                 m_objConfigHis.m_strAveConduct, m_objConfigHis.m_strLsampleNum,
                                                 m_objConfigHis.m_strNum, m_objConfigHis.m_strStartBott,
                                                 m_objConfigHis.m_strSampleWay, m_objConfigHis.m_strTOCValue,
                                                 m_objConfigHis.m_strTCValue, m_objConfigHis.m_strConduct);

            TOCTest.db.dbMrg.AlterDB(strConnection, strDBInfo);
            Console.WriteLine(m_objConfigHis);
        }
        string dealCon(string Index, ConfigHis objConfigHis)
        {
            char[] parsChar = { ',' };
            int    nTemp    = Convert.ToInt32(objConfigHis.m_strSum_Num);
            string strReult = "";

            strReult = strReult + Index + ',' + objConfigHis.m_strCodeType + ',' + objConfigHis.m_strCodeName + ','
                       + objConfigHis.m_strStartTime + ',' + objConfigHis.m_strLsampleNum + ',' + objConfigHis.m_strNum + ','
                       + objConfigHis.m_strStartBott + ',' + objConfigHis.m_strSampleWay + ',' + objConfigHis.m_strSum_Num + ',' + objConfigHis.m_strOperator + ',';

            strReult = strReult + objConfigHis.m_strTOCValue + objConfigHis.m_strTCValue + objConfigHis.m_strConduct + "\r\n";
            return(strReult);
        }
        string dealOnline(string Index, ConfigHis objConfigHis)
        {
            char[] parsChar = { ',' };
            int    nTemp    = Convert.ToInt32(objConfigHis.m_strLsampleNum);
            string strReult = "";

            strReult = strReult + Index + ',' + objConfigHis.m_strCodeType + ',' + objConfigHis.m_strCodeName + ',' + objConfigHis.m_strStartTime + ','
                       + objConfigHis.m_strLsampleNum + ',' + objConfigHis.m_strOperator + ',';
            for (int i = 0; i < nTemp; i = i + 1)
            {
                strReult = strReult + objConfigHis.m_strTOCValue.Split(parsChar)[(i)].ToString() + "," + objConfigHis.m_strTCValue.Split(parsChar)[(i)].ToString() + "," + objConfigHis.m_strConduct.Split(parsChar)[(i)].ToString() + ",";
            }
            strReult = strReult + "\r\n";
            return(strReult);
        }
        void dealConduct(string sLine)
        {
            ConfigHis m_objConfigHis = new ConfigHis();

            char[] parsChar = { ',' };
            int    id       = Convert.ToInt32(sLine.Split(parsChar)[0].ToString());

            m_objConfigHis.m_strCodeType   = sLine.Split(parsChar)[1].ToString();
            m_objConfigHis.m_strCodeName   = sLine.Split(parsChar)[2].ToString();
            m_objConfigHis.m_strStartTime  = sLine.Split(parsChar)[3].ToString();
            m_objConfigHis.m_strLsampleNum = sLine.Split(parsChar)[4].ToString();
            m_objConfigHis.m_strNum        = sLine.Split(parsChar)[5].ToString();
            m_objConfigHis.m_strStartBott  = sLine.Split(parsChar)[6].ToString();
            m_objConfigHis.m_strSampleWay  = sLine.Split(parsChar)[7].ToString();
            m_objConfigHis.m_strSum_Num    = sLine.Split(parsChar)[8].ToString();
            m_objConfigHis.m_strOperator   = sLine.Split(parsChar)[9].ToString();

            int nTemp = Convert.ToInt32(sLine.Split(parsChar)[4].ToString());

            for (int i = 0; i < nTemp; i++)
            {
                m_objConfigHis.m_strTOCValue = m_objConfigHis.m_strTOCValue + sLine.Split(parsChar)[(10 + i * 21 + 0)].ToString() + "," + sLine.Split(parsChar)[(10 + i * 21 + 3)].ToString() + "," + sLine.Split(parsChar)[(10 + i * 21 + 6)].ToString() + "," + sLine.Split(parsChar)[(10 + i * 21 + 9)].ToString() + "," + sLine.Split(parsChar)[(10 + i * 21 + 12)].ToString() + "," + sLine.Split(parsChar)[(10 + i * 21 + 15)].ToString() + "," + sLine.Split(parsChar)[(10 + i * 21 + 18)].ToString() + ",";
                m_objConfigHis.m_strTCValue  = m_objConfigHis.m_strTCValue + sLine.Split(parsChar)[(10 + i * 21 + 1)].ToString() + "," + sLine.Split(parsChar)[(10 + i * 21 + 4)].ToString() + "," + sLine.Split(parsChar)[(10 + i * 21 + 7)].ToString() + "," + sLine.Split(parsChar)[(10 + i * 21 + 10)].ToString() + "," + sLine.Split(parsChar)[(10 + i * 21 + 13)].ToString() + "," + sLine.Split(parsChar)[(10 + i * 21 + 16)].ToString() + "," + sLine.Split(parsChar)[(10 + i * 21 + 19)].ToString() + ",";
                m_objConfigHis.m_strConduct  = m_objConfigHis.m_strConduct + sLine.Split(parsChar)[(10 + i * 21 + 2)].ToString() + "," + sLine.Split(parsChar)[(10 + i * 21 + 5)].ToString() + "," + sLine.Split(parsChar)[(10 + i * 21 + 8)].ToString() + "," + sLine.Split(parsChar)[(10 + i * 21 + 11)].ToString() + "," + sLine.Split(parsChar)[(10 + i * 21 + 14)].ToString() + "," + sLine.Split(parsChar)[(10 + i * 21 + 17)].ToString() + "," + sLine.Split(parsChar)[(10 + i * 21 + 20)].ToString() + ",";
            }
            m_objConfigHis.m_strAveTOCValue = sLine.Split(parsChar)[10 + 18].ToString();
            m_objConfigHis.m_strAveTCValue  = sLine.Split(parsChar)[10 + 7 + 18].ToString();
            m_objConfigHis.m_strAveConduct  = sLine.Split(parsChar)[10 + 7 * 2 + 18].ToString();
            m_objConfigHis.m_strBott_Amount = sLine.Split(parsChar)[11].ToString();

            string strConnection = "Provider=Microsoft.Jet.OLEDB.4.0;  Data Source=..\\..\\mdb\\HistoryData.mdb";
            string strDBInfo     = String.Format("insert into {0} ([id],[CodeType],[CodeName],[Test_StartDt],[Test_EndDt],[Test_OprationName],[Channlesum],[OnlinestFlag],[AveTOCValue],[AveTCValue],[AveConduct],[Bott_Amount],[LsampleNum],[Htest_testimes],[Start_Bott],[SampleWay],[TOCValue],[TCValue],[Conduct],[Htest_sum]) values ({1},'{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}','{15}','{16}','{17}','{18}','{19}','{20}')",
                                                 TOCTest.Main.ms_strDeviceName, id, m_objConfigHis.m_strCodeType,
                                                 m_objConfigHis.m_strCodeName, m_objConfigHis.m_strStartTime,
                                                 m_objConfigHis.m_strEndTime, m_objConfigHis.m_strOperator,
                                                 m_objConfigHis.m_strChannlesum, m_objConfigHis.m_stronlinestflag,
                                                 m_objConfigHis.m_strAveTOCValue, m_objConfigHis.m_strAveTCValue,
                                                 m_objConfigHis.m_strAveConduct, m_objConfigHis.m_strBott_Amount,
                                                 m_objConfigHis.m_strLsampleNum,
                                                 m_objConfigHis.m_strNum, m_objConfigHis.m_strStartBott,
                                                 m_objConfigHis.m_strSampleWay, m_objConfigHis.m_strTOCValue,
                                                 m_objConfigHis.m_strTCValue, m_objConfigHis.m_strConduct, m_objConfigHis.m_strSum_Num);

            TOCTest.db.dbMrg.AlterDB(strConnection, strDBInfo);
            Console.WriteLine(m_objConfigHis);
        }
        private void m_btnExportDataView_Click(object sender, EventArgs e)
        {
            try
            {
                if (dataGridViewExportInfo.Rows.Count > 0)
                {
                    saveFileDialogExport.InitialDirectory = @"..\..\";
                    saveFileDialogExport.Filter           = "文件|*.*";
                    saveFileDialogExport.FilterIndex      = 2;
                    saveFileDialogExport.ShowHelp         = true;
                    saveFileDialogExport.Title            = "保存";
                    saveFileDialogExport.FileName         = DateTime.Now.ToString("yyyy-MM-dd ");
                    saveFileDialogExport.RestoreDirectory = true;
                    if (saveFileDialogExport.ShowDialog() == DialogResult.OK)
                    {
                        string strSaveName = saveFileDialogExport.FileName.ToString();
                        m_listConfigHis.Clear();
                        string str = DateTime.Now.ToString("yyyy-MM-dd hh:mm") + "\r\n" + dataGridViewExportInfo.Rows.Count.ToString() + "\r\n";
                        for (int i = 0; i < dataGridViewExportInfo.Rows.Count; i++)
                        {
                            ConfigHis objConfigHis = new ConfigHis();
                            objConfigHis.m_strCodeType     = dataGridViewExportInfo.Rows[i].Cells[1].Value.ToString();
                            objConfigHis.m_strCodeName     = dataGridViewExportInfo.Rows[i].Cells[2].Value.ToString();
                            objConfigHis.m_strStartTime    = dataGridViewExportInfo.Rows[i].Cells[3].Value.ToString();
                            objConfigHis.m_strEndTime      = dataGridViewExportInfo.Rows[i].Cells[4].Value.ToString();
                            objConfigHis.m_strOperator     = dataGridViewExportInfo.Rows[i].Cells[5].Value.ToString();
                            objConfigHis.m_strChannlesum   = dataGridViewExportInfo.Rows[i].Cells[6].Value.ToString();
                            objConfigHis.m_stronlinestflag = dataGridViewExportInfo.Rows[i].Cells[7].Value.ToString();
                            objConfigHis.m_strAveTOCValue  = dataGridViewExportInfo.Rows[i].Cells[8].Value.ToString();
                            objConfigHis.m_strAveTCValue   = dataGridViewExportInfo.Rows[i].Cells[9].Value.ToString();
                            objConfigHis.m_strAveConduct   = dataGridViewExportInfo.Rows[i].Cells[10].Value.ToString();
                            objConfigHis.m_strLsampleNum   = dataGridViewExportInfo.Rows[i].Cells[11].Value.ToString();
                            objConfigHis.m_strNum          = dataGridViewExportInfo.Rows[i].Cells[12].Value.ToString();
                            objConfigHis.m_strStartBott    = dataGridViewExportInfo.Rows[i].Cells[13].Value.ToString();
                            objConfigHis.m_strSampleWay    = dataGridViewExportInfo.Rows[i].Cells[14].Value.ToString();
                            objConfigHis.m_strTOCValue     = dataGridViewExportInfo.Rows[i].Cells[15].Value.ToString();
                            objConfigHis.m_strTCValue      = dataGridViewExportInfo.Rows[i].Cells[16].Value.ToString();
                            objConfigHis.m_strConduct      = dataGridViewExportInfo.Rows[i].Cells[17].Value.ToString();
                            objConfigHis.m_strSum_Num      = dataGridViewExportInfo.Rows[i].Cells[18].Value.ToString();
                            m_listConfigHis.Add(objConfigHis);
                        }
                        int j = 1;
                        foreach (ConfigHis obj in m_listConfigHis)
                        {
                            string Index     = j.ToString();
                            string Test_type = obj.m_strCodeType;
                            switch (Test_type)
                            {
                            case "1":
                                str = str + dealOffline(Index, obj);
                                break;

                            case "2":
                                str = str + dealOnline(Index, obj);
                                break;

                            case "3":
                                str = str + dealCon(Index, obj);
                                break;

                            default:
                                break;
                            }
                            j++;
                        }
                        File.WriteAllText(strSaveName, str, System.Text.Encoding.GetEncoding("GB2312"));
                        MessageBox.Show("已导出文件!");
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("异常:" + ex.ToString(), "提示");
            }
        }