我正在使用Oledb从Paradox表中读取一些数据。我遇到的问题是代码在我将其复制到控制台应用程序但不在WinForms中时有效。调试为x86,我只是复制代码。在WinForms App中,我得到的外表不是预期的格式Exception。
我的代码:
StringBuilder ConnectionString = new StringBuilder();
OleDbConnection connection = new OleDbConnection();
ConnectionString.Append("Provider=Microsoft.Jet.OLEDB.4.0;");
ConnectionString.Append("Data Source=C:\test;");
ConnectionString.Append("Extended Properties='Paradox 5.x'");
connection.ConnectionString = ConnectionString.ToString();
OleDbCommand command = new OleDbCommand();
string query = "SELECT * FROM NACHKALK WHERE Auftrag='U04-0001'";
command.CommandText = query;
command.Connection = connection;
connection.Open();
OleDbDataAdapter adp = new OleDbDataAdapter(command);
adp.Fill(dset);
connection.Close();
有人知道如何解决这个问题吗?