帮助。在这条线上失败:adapter.Fill(ds); // ERROR 检查名称是否无效,它不包含无效字符或标点符号,并且不能太长。
openFileDialog1.Title = "Выбрать файл";
openFileDialog1.InitialDirectory ="C:\\";
openFileDialog1.Filter = "dbf файлы (*.dbf)|*.dbf";
openFileDialog1.FilterIndex = 2;
openFileD`ial`og1.RestoreDirectory = true;
openFileDialog1.FileName = "";
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
string fullPathname = openFileDialog1.FileName;
FileInfo fi = new FileInfo(fullPathname);
string open_b = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + fi.Directory + ";Extended Properties=dBase 5.0;Mode=Read|Write|Share Deny None;Persist Security Info=True";
OleDbConnection con = new OleDbConnection();
con.ConnectionString = open_b;
con.Open();
string vibor_t = "Select * From '" + fi.Name + "'";
//string vibor_t = "Select * From '" + Path.GetFileNameWithoutExtension(fi.Name) + "'";
OleDbDataAdapter adapter = new OleDbDataAdapter(vibor_t, con);
DataSet ds = new DataSet();
adapter.Fill(ds); // ERROR
con.Close();
this.dataGridView1.DataSource = ds.Tables[0];