如何转换VFPOLEDB文件类型到数据库III
本文关键字:类型 文件 数据库 III VFPOLEDB 何转换 转换 | 更新日期: 2023-09-27 18:13:28
我想知道如何将dbf文件类型VFPOLEDB
转换为dbase III
?
byte[] bytes = System.IO.File.ReadAllBytes(path + "MyFile.dbf");
bytes[0] = 3;
File.WriteAllBytes(path + "my.dbf", bytes);
string connectionString = @"Provider=VFPOLEDB.1;Data
Source=C:'YourDirectory'";
using (OleDbConnection connection = new OleDbConnection(connectionString))
{
using (OleDbCommand scriptCommand = connection.CreateCommand())
{
connection.Open();
string vfpScript = @"USE TestDBF
COPY TO OldDBaseFormatFile TYPE Fox2x
USE";
scriptCommand.CommandType = CommandType.StoredProcedure;
scriptCommand.CommandText = "ExecScript";
scriptCommand.Parameters.Add("myScript", OleDbType.Char).Value = vfpScript;
scriptCommand.ExecuteNonQuery();
}
}