我想通过 HFSQL ODBC 驱动程序从 C# 访问 Windev 数据库。
static void Main(string[] args)
{
try
{
OdbcConnection MyConnection =
new OdbcConnection(
"Driver={HFSQL};" +
"ANA=w:\\C7.wdd;" +
"Server Name =10.90.6.20;" +
"Server Port =4900; " +
"Database =DBASE; " +
"UID =user; " +
"PWD =1234;");
MyConnection.Open();
MyData.Close();
MyConnection.Close();
}
catch (OdbcException eExcpt)
{
// Display the errors
Console.WriteLine("Source = " + eExcpt.Source);
Console.WriteLine("Message = " + eExcpt.Message);
}
// pause before exiting
Console.ReadLine();
}
MyConnection.Open();
发送此错误:
Source =
Message = ERROR [08001] <DvDecEntete> file already defined.
Debugging information:
IEWDHF=32.2
Module=<WDHF>
Version=<26.0.313.5>
所有参数都ok!
什么问题?解决方案是什么?
解决了。 数据库是法语的,使用 OLE 和 ODBC ascii 字符集来命名表。其中一张表的名称中有一个特殊的法语“ê”,而同一张表是用普通的 ascii 名称创建的。 OLE/ODBC接口无法区分这两个表,所以出错了