I have a visual fox pro 9 database, and i am trying to connect it from my desktop application.
i can get data from almost all tables except one table.
when i run query to select data from "test.dbf" it throws exception saying
File 'phd.prg' does not exists
i am using VFP OLEDB drivers to connect with database.
DataTable YourResultSet = new DataTable();
OleDbConnection yourConnectionHandler = new OleDbConnection(
"Provider=VFPOLEDB.1;Data Source=E:/TRACKONE.DBC;Exclusive=false;Nulls=false;");
yourConnectionHandler.Open();
if (yourConnectionHandler.State == ConnectionState.Open)
{
OleDbDataAdapter DA = new OleDbDataAdapter();
string mySQL = "SELECT * FROM TEST.DBF";
OleDbCommand MyQuery = new OleDbCommand(mySQL, yourConnectionHandler);
DA.SelectCommand = MyQuery;
try
{
DA.Fill(YourResultSet);
}
catch (OleDbException ex)
{
MessageBox.Show(ex.Message.ToString());
}
yourConnectionHandler.Close();
return YourResultSet;
}
else
{
MessageBox.Show("Error Opening Databse");
}
return null;