Search code examples
c#odbcdatabase-connectionwindev

Using HFSQL over ODBC


I want to access a Windev database from C# through the HFSQL ODBC driver.

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(); sends this error:

Source =
Message = ERROR [08001] <DvDecEntete> file already defined.
Debugging information:
IEWDHF=32.2
Module=<WDHF>
Version=<26.0.313.5>

All parameters are ok!

What's the problem? And what is the solution?


Solution

  • It was solved. The database was in French, using the OLE and ODBC ascii character sets to name the tables. One of the tables had a special French "ê" in its name, and the same table was created with a normal ascii name. The OLE / ODBC interface could not distinguish between the two tables, so there was an error.