private bool TestDbSource() { if (string.IsNullOrEmpty(this.TxtDataSource.Text)) { this.TxtTestStat.Text = "请输入正确的代码!"; return(false); } string text = this.TxtDataSource.Text; string selectedValue = this.RbtDataType.SelectedValue; if (string.Compare(selectedValue, "mdb_read", StringComparison.Ordinal) == 0) { text = "Provider=Microsoft.JET.OLEDB.4.0;Data Source=" + GetDbPath(this.TxtDataSource.Text); selectedValue = "ole_read"; } if (string.Compare(selectedValue, "xsl_read", StringComparison.Ordinal) == 0) { text = "Provider=Microsoft.JET.OLEDB.4.0;Extended Properties=Excel 8.0;Data Source=" + GetDbPath(this.TxtDataSource.Text); selectedValue = "ole_read"; } if (LabelManage.TestOutSideDatabase(selectedValue, text)) { this.TxtTestStat.Text = "连接成功!"; return(true); } this.TxtTestStat.Text = "连接失败!"; return(false); }