DBF Viewer2000 可以正常打开、Visual FoxPro 6.0打开提示不是一个表。


以下是C#代码,求大神指点!


以下是C#代码,求大神指点!
//DataSet dataSet = new DataSet(); DataTable dt = new DataTable(); //string connectString = string.Format( // "Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Extended Properties=dBASE IV;User ID=Admin;Password=;", path); string connectString = string.Format( "Provider=VFPOLEDB.1;Data Source={0};Collating Sequence=MACHINE", path); using (OleDbConnection connection = new OleDbConnection(connectString)) { try { connection.Open(); OleDbDataAdapter adapt = new OleDbDataAdapter(); adapt.MissingSchemaAction = MissingSchemaAction.AddWithKey; adapt.SelectCommand = new OleDbCommand(sql, connection); adapt.Fill(dt); adapt.Dispose(); DataView dv = dt.DefaultView; dv.Dispose(); connection.Close(); //connection.Open(); //OleDbDataAdapter command = new OleDbDataAdapter(sql, connection); //if (command != null) //{ // command.Fill(dataSet); //} } catch (Exception ex) { MessageBox.Show(string.Format("error:{0}", ex.Message)); return null; } // return dataSet; return dt;
小弟电话:17717606525 感激不尽
解决方案
20
var conn = new OleDbConnection(@”provider=VFPOLEDB.1;Source Type=DBF;data source=.\;user id=admin;password=”);
data source 的值是 dbf 文件所在目录
其他不需要动
data source 的值是 dbf 文件所在目录
其他不需要动