コード例 #1
0
        private bool InitModuleDatabase()
        {
            if (sqlServer == null)
            {
                sqlServer = new SqlServerLogic(string.Format("Server={0};uid={1};pwd={2};", SingletonInfo.GetInstance().SqlServerIP, SingletonInfo.GetInstance().SqlServerUser, SingletonInfo.GetInstance().SqlServerPWD));
            }
            int createData = sqlServer.FromSql("CREATE DATABASE volador");

            MixLogHelper.Info(ClassName, createData != -100 ? "volador数据库创建成功" : "volador数据库创建失败");


            string pp      = AppDomain.CurrentDomain.BaseDirectory;
            bool   success = sqlServer.ExecuteCommand(sqlServer.GetSqlFile(Path.Combine(pp, "sqlinit"), "volador"));

            MixLogHelper.Info(ClassName, success ? "volador表创建成功" : "volador表创建失败");

            return(success);
        }
コード例 #2
0
        private bool InitModuleDatabase()
        {
            var appSettings = System.Configuration.ConfigurationManager.AppSettings;

            if (sqlServer == null)
            {
                sqlServer = new SqlServerLogic(string.Format("Server={0};uid={1};pwd={2};", appSettings["DatabaseServerIP"], appSettings["DatabaseUser"], appSettings["DatabasePwd"]));
            }
            int createData = sqlServer.FromSql("CREATE DATABASE volador");

            MixLogHelper.Info(ClassName, createData != -100 ? "volador数据库创建成功" : "volador数据库创建失败");

            bool success = sqlServer.ExecuteCommand(sqlServer.GetSqlFile(Path.Combine(Application.StartupPath, "sqlinit"), "volador"));

            MixLogHelper.Info(ClassName, success ? "volador表创建成功" : "volador表创建失败");

            return(success);
        }