private void button1_Click(object sender, EventArgs e) { string ip = this.txtIp.Text.Trim(); string dbname = this.txtDbName.Text.Trim(); string userid = this.txtUID.Text.Trim(); string pwd = this.txtPwd.Text.Trim(); if (dbname.Length > 0 && userid.Length > 0) { FT.DAL.IDataAccess access = null; if (this.cbDbType.Text.Trim().ToLower() == "sqlserver") { access = new FT.DAL.SqlServer.SqlServerDataHelper(ip, dbname, userid, pwd); } else if (this.cbDbType.Text.Trim().ToLower() == "oracle") { access = new FT.DAL.Oracle.OracleDataHelper(dbname, userid, pwd); } else if (this.cbDbType.Text.Trim().ToLower() == "access") { if (pwd.Length > 0) { access = new FT.DAL.Access.AccessDataHelper("Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=true;Data Source=" + dbname + ";Jet OLEDB:Database Password="******"测试成功!", "提示"); access.Close(); } else { MessageBox.Show("测试失败!", "提示"); } } catch (Exception ex) { MessageBoxHelper.Show(ex.ToString()); } } else { MessageBoxHelper.Show("必须填写数据库名和登陆名"); } }
private void CreatePlugin() { if (firstPlugin) { string path = Application.StartupPath + "/plugins/SystemPlugin.dll"; FileInfo dir = new FileInfo(path); AllPrinterConfig config = AllPrinterConfig.GetPrinterConfig(); string ip = config.SysConfig.Ip; string dbname = config.SysConfig.DbName; string userid = config.SysConfig.UID; string pwd = config.SysConfig.Pwd; if (dir.Exists && dbname.Length > 0 && userid.Length > 0) { System.Reflection.Assembly ass = System.Reflection.Assembly.LoadFile(path); Type t = ass.GetType("SystemPlugin.StudentPlugin"); Type t1 = typeof(FT.DAL.IDataAccess); System.Reflection.ConstructorInfo cinfo = t.GetConstructor(new Type[] { t1 }); object o1 = null; if (config.SysConfig.DbType.ToLower() == "sqlserver") { o1 = new FT.DAL.SqlServer.SqlServerDataHelper(ip, dbname, userid, pwd); } else if (config.SysConfig.DbType.ToLower() == "oracle") { o1 = new FT.DAL.Oracle.OracleDataHelper(dbname, userid, pwd); } else if (config.SysConfig.DbType.ToLower() == "access") { if (pwd.Length > 0) { o1 = new FT.DAL.Access.AccessDataHelper("Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=true;Data Source=" + dbname + ";Jet OLEDB:Database Password="******"没有找到插件类,无法同步!"); } } firstPlugin = false; } }
private void CreatePlugin() { if (firstPlugin) { string path = Application.StartupPath + "/plugins/SystemPlugin.dll"; FileInfo dir = new FileInfo(path); AllPrinterConfig config = AllPrinterConfig.GetPrinterConfig(); string ip = config.SysConfig.Ip; string dbname = config.SysConfig.DbName; string userid = config.SysConfig.UID; string pwd = config.SysConfig.Pwd; if (dir.Exists && dbname.Length > 0 && userid.Length > 0) { System.Reflection.Assembly ass = System.Reflection.Assembly.LoadFile(path); Type t = ass.GetType("SystemPlugin.StudentPlugin"); Type t1 = typeof(FT.DAL.IDataAccess); System.Reflection.ConstructorInfo cinfo = t.GetConstructor(new Type[] { t1 }); object o1 = null; if (config.SysConfig.DbType.ToLower() == "sqlserver") { o1 = new FT.DAL.SqlServer.SqlServerDataHelper(ip, dbname, userid, pwd); } else if (config.SysConfig.DbType.ToLower() == "oracle") { o1 = new FT.DAL.Oracle.OracleDataHelper(dbname, userid, pwd); } else if (config.SysConfig.DbType.ToLower() == "access") { if (pwd.Length > 0) { o1 = new FT.DAL.Access.AccessDataHelper("Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=true;Data Source=" + dbname + ";Jet OLEDB:Database Password="******"û���ҵ�����࣬��ͬ����"); } } firstPlugin = false; } }
private void button1_Click(object sender, EventArgs e) { string ip =this.txtIp.Text.Trim() ; string dbname = this.txtDbName.Text.Trim() ; string userid = this.txtUID.Text.Trim(); string pwd = this.txtPwd.Text.Trim(); if (dbname.Length > 0 && userid.Length > 0) { FT.DAL.IDataAccess access = null; if (this.cbDbType.Text.Trim().ToLower() == "sqlserver") { access = new FT.DAL.SqlServer.SqlServerDataHelper(ip, dbname, userid, pwd); } else if (this.cbDbType.Text.Trim().ToLower() == "oracle") { access = new FT.DAL.Oracle.OracleDataHelper(dbname, userid, pwd); } else if (this.cbDbType.Text.Trim().ToLower() == "access") { if(pwd.Length>0) { access=new FT.DAL.Access.AccessDataHelper("Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=true;Data Source=" + dbname + ";Jet OLEDB:Database Password="******"���Գɹ���", "��ʾ"); access.Close(); } else { MessageBox.Show("����ʧ�ܣ�", "��ʾ"); } } catch (Exception ex) { MessageBoxHelper.Show(ex.ToString()); } } else { MessageBoxHelper.Show("������д���ݿ����͵�½��"); } }