private void Form1_Load(object sender, EventArgs e) { string dbpath = Application.StartupPath + "\\TEST.accdb"; if (!File.Exists(dbpath)) { MessageBox.Show("没有找到数据库文件,请先[创建数据库]"); this.lblMsg.Text = "没有找到数据库文件,请先[创建数据库]"; } else { btnCreateDB.Enabled = false; this.lblMsg.Text = "当前数据库文件:" + dbpath; //配置连接 PWMIS.AccessExtensions.AccessUility.ConfigConnectionSettings("AccessConn", dbpath); } UserTypeInfoDataSource.InitDataSource(this.userTypeInfoBindingSource); this.dataGridView1.AutoGenerateColumns = false; }
/* * private User BindingUserData; * 增加类似的代码: * TextBox1.DataBindings.Add("Text", company, "Name"); * TextBox1.DataBindings.Add("Text", company, "Employees.Name"); */ private void Form2_Load(object sender, EventArgs e) { UserTypeInfoDataSource.InitDataSource(this.userTypeInfoBindingSource); }