Ejemplo n.º 1
0
            public void GetDataBaseDefault()
            {
                Class_PublicMethod       class_PublicMethod       = new Class_PublicMethod();
                Class_DataBaseConDefault class_DataBaseConDefault = new Class_DataBaseConDefault();

                class_DataBaseConDefault = class_PublicMethod.FromXmlToDefaultValueObject <Class_DataBaseConDefault>("DataBaseDefaultValues");

                if (class_DataBaseConDefault == null)
                {
                    databaseType       = "MySql";
                    dataBaseName       = "test01";
                    dataSourceUserName = "******";
                    dataSourcePassWord = "******";
                    dataSourceUrl      = "101.201.101.138";
                    Port = 10001;
                }
                else
                {
                    databaseType       = class_DataBaseConDefault.databaseType;
                    dataBaseName       = class_DataBaseConDefault.dataBaseName;
                    dataSourceUserName = class_DataBaseConDefault.dataSourceUserName;
                    dataSourcePassWord = class_DataBaseConDefault.dataSourcePassWord;
                    dataSourceUrl      = class_DataBaseConDefault.dataSourceUrl;
                    Port = class_DataBaseConDefault.Port;
                }
            }
Ejemplo n.º 2
0
        public Class_SqlServer2017DataBase(string ip, string dataBaseName, string userName, string passWord)
        {
            if (ip != null)
            {
                this.Ip           = ip;
                this.DataBaseName = dataBaseName;
                this.UserName     = userName;
                this.PassWord     = passWord;
            }
            else
            {
                Class_PublicMethod       class_PublicMethod       = new Class_PublicMethod();
                Class_DataBaseConDefault class_DataBaseConDefault = new Class_DataBaseConDefault();
                class_DataBaseConDefault = class_PublicMethod.FromXmlToSelectObject <Class_DataBaseConDefault>("DataBaseDefaultValues");

                if (class_DataBaseConDefault == null)
                {
                    this.Ip           = "221.234.36.229";
                    this.DataBaseName = "QD_MANAGER";
                    this.UserName     = "******";
                    this.PassWord     = "******";
                }
                else
                {
                    if (class_DataBaseConDefault.databaseType == "SqlServer 2017")
                    {
                        this.Ip           = class_DataBaseConDefault.dataSourceUrl;
                        this.DataBaseName = class_DataBaseConDefault.dataBaseName;
                        this.UserName     = class_DataBaseConDefault.dataSourceUserName;
                        this.PassWord     = class_DataBaseConDefault.dataSourcePassWord;
                    }
                }
            }
            IniFieldTypeChange();
            ConnectString = string.Format("Data Source={0};Initial Catalog={1};Persist Security Info=True;User ID={2};Password={3}"
                                          , this.Ip
                                          , this.DataBaseName
                                          , this.UserName
                                          , this.PassWord);
            mydb = new Mydb(ConnectString);
        }