private void btnChangeDbInfo_Click(object sender, EventArgs e)
        {
            LvDestination.Items.Clear();
            ClassDBInfo.OK = false;
            FrmDestinationDbInfo frmdb = new FrmDestinationDbInfo();

            frmdb.dbtype = CboDbType.Text.ToUpper();
            frmdb.ShowDialog();
            try
            {
                if (ClassDBInfo.OK == true)
                {
                    Application.DoEvents();
                    FillDestinationFields();
                    if (LvDestination.Items.Count > 0)
                    {
                        btnmap.Enabled = true;
                    }
                }


                string path = Application.StartupPath + @"\FieldsMapping.xml";
                if (File.Exists(path))
                {
                    varTable = null;
                    if (varTable == null)
                    {
                        varTable           = new DataTable();
                        varTable.TableName = "FieldsMapping";
                        varTable.Columns.Add("SourceColumn");
                        varTable.Columns.Add("DestinationColumn");
                        varTable.Columns.Add("ColumnDataType");
                        varTable.Columns.Add("ConType");
                        varTable.Columns.Add("TableNameSource");
                        varTable.Columns.Add("TableNameDestination");
                        varTable.AcceptChanges();
                    }
                    varTable.ReadXml(path);
                    FillLvMap();
                }
            }
            catch (Exception ex)
            {
                WriteErrorLog(spath, ex.Message + "   " + ex.ToString());
                MessageBox.Show(ex.Message.ToString(), "btnChangeDbInfo_Click", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void CboDbType_SelectedIndexChanged(object sender, EventArgs e)
        {
            btnChangeDbInfo.Visible = false;
            LvDestination.Items.Clear();
            LvMap.Items.Clear();
            try
            {
                if (CboDbType.SelectedIndex != 0)
                {
                    string varpath = Application.StartupPath + @"\DbConInfo.xml";
                    if (File.Exists(varpath) == true)
                    {
                        DataTable table = new DataTable();
                        table.TableName = "TblConnection";
                        table.Columns.Add("ServerName");
                        table.Columns.Add("DbName");
                        table.Columns.Add("Uid");
                        table.Columns.Add("Pwd");
                        table.Columns.Add("Type");

                        table.ReadXml(varpath);
                        if (table.Rows.Count > 0)
                        {
                            if (table.Rows[0]["Type"].ToString().ToUpper() == CboDbType.Text.ToUpper())
                            {
                                btnChangeDbInfo.Visible = true;
                                ClassDBInfo.DBType      = CboDbType.Text.ToUpper();
                                ClassDBInfo.Server      = table.Rows[0]["ServerName"].ToString();
                                ClassDBInfo.DbName      = table.Rows[0]["DbName"].ToString();
                                ClassDBInfo.UID         = table.Rows[0]["Uid"].ToString();
                                ClassDBInfo.Pwd         = table.Rows[0]["Pwd"].ToString();
                                ClassDBInfo.OK          = true;
                            }
                            else
                            {
                                ClassDBInfo.OK = false;
                                FrmDestinationDbInfo frmdb = new FrmDestinationDbInfo();
                                frmdb.dbtype = CboDbType.Text.ToUpper();
                                frmdb.ShowDialog();
                            }
                        }
                    }
                    else
                    {
                        ClassDBInfo.OK = false;
                        FrmDestinationDbInfo frmdb = new FrmDestinationDbInfo();
                        frmdb.dbtype = CboDbType.Text.ToUpper();
                        frmdb.ShowDialog();
                    }
                    if (ClassDBInfo.OK == true)
                    {
                        Application.DoEvents();
                        FillDestinationTables();

                        if (LvDestination.Items.Count > 0)
                        {
                            btnmap.Enabled = true;
                        }
                        string path = Application.StartupPath + @"\FieldsMapping.xml";
                        if (File.Exists(path))
                        {
                            varTable = null;
                            if (varTable == null)
                            {
                                varTable           = new DataTable();
                                varTable.TableName = "FieldsMapping";
                                varTable.Columns.Add("SourceColumn");
                                varTable.Columns.Add("DestinationColumn");
                                varTable.Columns.Add("ColumnDataType");
                                varTable.Columns.Add("ConType");
                                varTable.Columns.Add("TableNameSource");
                                varTable.Columns.Add("TableNameDestination");
                                varTable.AcceptChanges();
                            }
                            varTable.ReadXml(path);


                            if (varTable.Rows.Count > 0 && varTable.Rows[0]["ConType"].ToString().ToUpper() == CboDbType.Text.ToUpper())
                            {
                                FillLvMap();
                            }
                            else
                            {
                                varTable.Rows.Clear();
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                //WriteErrorLog(spath, ex.Message + "   " + ex.ToString());
                MessageBox.Show(ex.Message.ToString(), "CboDbType_SelectedIndexChanged", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }