Example #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            string strIP = tbIP.Text.Trim();
                        MyString s = new MyString();
                        if (!s.IsIPAddress(strIP))
                        {
                                MessageBox.Show("数据库IP地址有误,请确认后重新数据", "提示");
                                return;
                        }

                        string strUser = tbUser.Text.Trim();
                        string strPwd = tbPassword.Text.Trim();

                        XmlConfig xml = XmlConfig.Instance(m_strConfigPath);

                        xml.Write("sqlserver", "addr", strIP);
                        xml.Write("sqlserver", "user", strUser);
                        xml.Write("sqlserver", "pwd", strPwd);

                        // 更新主窗体中的数据库配置
                        Form1 f = (Form1)this.Owner;
                        f.m_strSQLName = strIP;
                        f.m_strSQLUser = strUser;
                        f.m_strSQLPwd = strPwd;

                        MessageBox.Show("保存成功", "提示");
                        this.Close();
        }
Example #2
0
 public MyTime()
 {
     MyString s = new MyString();
 }
Example #3
0
        public Form1()
        {
            InitializeComponent();
                        CheckForIllegalCrossThreadCalls = false;

                        #region MyLib初始化
                        m_f = new MyFile();
                        m_excel = new MyExcelReader();
                        m_db = new MyDB();
                        m_path = new MyPath();
                        m_time = new MyTime();
                        m_str = new MyString();
                        // m_workbook = new XSSFWorkbook();
                        m_dsHelper = new MyDataSetHelper();
                        #endregion
        }