Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                var connSetting = ConfigurationManager.ConnectionStrings[ConfigurationManager.ConnectionStrings.Count - 1];
                this.lblProviderName.Text = connSetting.ProviderName;
                this.lblConnName.Text     = connSetting.Name;
                if (Session["errmsg"] != null)
                {
                    this.lblErrMsg.Text = Session["errmsg"].ToString();
                }

                GetScriptName();

                if (MyDB.Instance.CurrentDBMSType == PWMIS.Common.DBMSType.Access)
                {
                    //Access access = MyDB.Instance as Access;
                    //string dbFilePath = access.ConnectionDataSource;
                    //if (!System.IO.File.Exists(dbFilePath))
                    //{
                    //    PWMIS.AccessExtensions.AccessUility.CreateDataBase(dbFilePath,
                    //        MyDB.Instance.ConnectionStringBuilder as System.Data.OleDb.OleDbConnectionStringBuilder);
                    //    this.lblErrMsg.Text += ";Access 数据库文件已经自动创建,请刷新或者继续操作本页面。 ";
                    //}

                    AccessDbContext accCtx = new AccessDbContext(MyDB.Instance as Access);
                    accCtx.CheckDB();

                    this.lblScript.Text = "当前数据库文件:" + accCtx.DBFilePath;
                }
            }
        }