1.安装FoxPro OleDb Provider.下载地址如下
2.代码如下
string ole_connstring = @"Provider=VFPOLEDB.1;Data Source=D:/dbfdata;";
OleDbConnection ole_conn = new OleDbConnection(ole_connstring);
ole_conn.Open();
OleDbCommand cmd1 = new OleDbCommand("Create Table TestTable (Field1 int, Field2 char(10))", ole_conn);
OleDbCommand cmd2 = new OleDbCommand("Insert Into TestTable values (1,'Hello3')", ole_conn);
OleDbCommand cmd3 = new OleDbCommand("Insert Into TestTable values (2,'Hello4')", ole_conn);
cmd1.ExecuteNonQuery();
cmd2.ExecuteNonQuery();
cmd3.ExecuteNonQuery();
ole_conn.Close();