///读取数据库的。
try
{
this.openFileDialog2.Filter = "ACCESS数据库文件 (*.MDB)|*.mdb";
openFileDialog2.Title = "请选择数据库:";
if(this.openFileDialog2.ShowDialog()==DialogResult.OK)
{
int abc=this.openFileDialog2.ToString().LastIndexOf("FileName:");
sFile=this.openFileDialog2.ToString().Substring(abc+9,this.openFileDialog2.ToString().Length-abc-9);
MessageBox.Show(sFile);
olestr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+sFile+";Persist Security Info=True;Jet OLEDB:Database Password=xuzhehuiaspnet163";
ReaderData();
}
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}