C#中如何创建dbf数据库文件(文件类型要求为FoxBASE+/Dbase III plus)。
C#中如何创建dbf数据库文件(文件类型要求为FoxBASE+/Dbase III plus)。
通过选择的dataset数据,生成财务接口文件,导入到金蝶中的dbf文件。
我在网上找到可以创建Visual FoxPro文件类型的dbf文件了,但是可能导入金蝶不支持。代码如下:
string str_oleConn = @"Provider=VFPOLEDB.1;Data Source=C:\;";
System.Data.OleDb.OleDbConnection ole_conn = new System.Data.OleDb.OleDbConnection(str_oleConn);
try
{
ole_conn.Open();
System.Data.OleDb.OleDbCommand cmd1 = new System.Data.OleDb.OleDbCommand
("Create Table TestTable1 (Field1 int, Field2 char(10),Field float(10,2))",
ole_conn);
System.Data.OleDb.OleDbCommand cmd2 = new System.Data.OleDb.OleDbCommand
("Insert Into TestTable values (1,'Hello3',520.20)", ole_conn);
System.Data.OleDb.OleDbCommand cmd3 = new System.Data.OleDb.OleDbCommand
("Insert Into TestTable values (2,'Hello4',18076.60)", ole_conn);
cmd1.ExecuteNonQuery();
cmd2.ExecuteNonQuery();
cmd3.ExecuteNonQuery();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
ole_conn.Close();
}
不知道朋友们有没有办法能创建dbase格式的dbf数据库。