Beispiel #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            FT.DAL.Access.AccessDataHelper access = new FT.DAL.Access.AccessDataHelper("Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=true;Data Source=\\\\" + this.txtShareDbIp.Text.Trim() + "\\db\\db.mdb;Jet OLEDB:Database Password=SQL");
            try
            {
                if (access.Open())
                {
                    XmlDocument doc = new XmlDocument();
                    doc.Load(Application.ExecutablePath + ".config");

                    XmlNode    node1 = doc.SelectSingleNode(@"//add[@key='" + connKey + "']");
                    XmlElement ele1  = (XmlElement)node1;
                    ele1.SetAttribute("value", FT.Commons.Security.SecurityFactory.GetSecurity().Encrypt("Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=true;Data Source=\\\\" + this.txtShareDbIp.Text.Trim() + "\\db\\db.mdb;Jet OLEDB:Database Password=SQL"));
                    doc.Save(Application.ExecutablePath + ".config");
                    MessageBoxHelper.Show("保存成功,请退出重进!");
                    access.Close();
                }
                else
                {
                    MessageBox.Show("连接" + this.txtShareDbIp.Text.Trim() + "失败,请检查目标机器是否可用,\r\n是否已经共享预录入系统的db文件夹!", "提示");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Beispiel #2
0
 private void btnTestShareDb_Click(object sender, EventArgs e)
 {
     FT.DAL.Access.AccessDataHelper access = new FT.DAL.Access.AccessDataHelper("Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=true;Data Source=\\\\" + this.txtShareDbIp.Text.Trim() + "\\db\\db.mdb;Jet OLEDB:Database Password=SQL");
     try
     {
         if (access.Open())
         {
             MessageBox.Show("连接成功!", "提示");
             access.Close();
         }
         else
         {
             MessageBox.Show("连接" + this.txtShareDbIp.Text.Trim() + "失败,请检查目标机器是否可用,\r\n是否已经共享预录入系统的db文件夹!", "提示");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
Beispiel #3
0
        private void button2_Click(object sender, EventArgs e)
        {
            FT.DAL.Access.AccessDataHelper access = new FT.DAL.Access.AccessDataHelper("Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=true;Data Source=\\\\" + this.txtShareDbIp.Text.Trim() + "\\db\\db.mdb;Jet OLEDB:Database Password=SQL");
            try
            {
                if (access.Open())
                {
                    XmlDocument doc = new XmlDocument();
                    doc.Load(Application.ExecutablePath + ".config");

                    XmlNode node1 = doc.SelectSingleNode(@"//add[@key='" + connKey + "']");
                    XmlElement ele1 = (XmlElement)node1;
                    ele1.SetAttribute("value", FT.Commons.Security.SecurityFactory.GetSecurity().Encrypt("Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=true;Data Source=\\\\" + this.txtShareDbIp.Text.Trim() + "\\db\\db.mdb;Jet OLEDB:Database Password=SQL"));
                    doc.Save(Application.ExecutablePath + ".config");
                    MessageBoxHelper.Show("����ɹ������˳��ؽ���");
                    access.Close();
                }
                else
                {
                    MessageBox.Show("����" + this.txtShareDbIp.Text.Trim() + "ʧ��,����Ŀ������Ƿ���ã�\r\n�Ƿ��Ѿ�����Ԥ¼��ϵͳ��db�ļ��У�", "��ʾ");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Beispiel #4
0
 private void btnTestShareDb_Click(object sender, EventArgs e)
 {
     FT.DAL.Access.AccessDataHelper access = new FT.DAL.Access.AccessDataHelper("Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=true;Data Source=\\\\" + this.txtShareDbIp.Text.Trim() + "\\db\\db.mdb;Jet OLEDB:Database Password=SQL");
     try
     {
         if (access.Open())
         {
             MessageBox.Show("���ӳɹ���", "��ʾ");
             access.Close();
         }
         else
         {
             MessageBox.Show("����" + this.txtShareDbIp.Text.Trim() + "ʧ��,����Ŀ������Ƿ���ã�\r\n�Ƿ��Ѿ�����Ԥ¼��ϵͳ��db�ļ��У�", "��ʾ");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }