LANGUAGE: C#, System: Windows7, Excel 2007
I want to create a .DBF from some data, and i want to open it from Excel 2007. It can be either dBase or foxpro. I am currently doing in FoxPro9 (btw this code is from the internet):
OleDbConnection con = new OleDbConnection("Provider=VFPOLEDB.1;Data Source=C:\\Temp\\;");
con.Open();
OleDbCommand cmd1 = new OleDbCommand("Create Table TestDBF (Field1 I, Field2 C(10))", con);
OleDbCommand cmd2 = new OleDbCommand("Insert Into TestDBF Values (1, 'Hello')", con);
OleDbCommand cmd3 = new OleDbCommand("Insert Into TestDBF Values (2, 'World')", con);
cmd1.ExecuteNonQuery();
cmd2.ExecuteNonQuery();
cmd3.ExecuteNonQuery();
con.Close();
This generates the file, which i can open in DbfViewer, however, i cant open it in Excel 2007 nor use in some applications i have. I can manually convert the FoxPro .dbf to a dbaseIII dbf using the DbfViwer, but i want it to be automatic.
Any ideas?
Thanks in advance