ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / Managing databases / Access via ODBC or OLE DB
  • Overview
  • Setup
  • Configuration
  • Use
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
ODBC on HFSQL via Visual .NET (in C#)
HFSQL ClassicAvailable only with this kind of connection
Overview
The ODBC driver on HFSQL Classic (single-user and multi-user) is used to access an HFSQL Classic database from an external database software that supports ODBC accesses. This gives you the ability to use the ODBC driver on HFSQL Classic via Visual.NET (in C#).

Setup

When installing WINDEV or WEBDEV on the development computer, the ODBC driver can be installed on HFSQL Classic.
Furthermore, when configuring the setup program of your WINDEV applications, you have the ability to include the setup of the ODBC driver on HFSQL.
Configuration
To use the ODBC driver on HFSQL, you must configure the ODBC driver:
  1. Start the ODBC data administrator (ODBCAD32.EXE) on your computer. To do so, select "Start .. Run" from Windows and type "ODBCAD32.EXE".
  2. Select the "User database" tab.
  3. Click the "Add" button.
  4. Select the "HyperFileSQL Classic" driver.
  5. Click "Done".
  6. Enter the name of the HFSQL data source. This name will be used to identify the HFSQL database in the external programs.
  7. Click the "Details" button.
  8. Click "Browse" to select the WDD file corresponding to the analysis.
  9. In the list of analyses, select the requested analysis and the directory of the data files ("Browse" button). All the HFSQL data files corresponding to the selected analysis are grouped in this directory.
    Caution: a file directory must be selected for each analysis.
  10. Validate ("OK" button).
The database can be used in read/write from the external programs via the ODBC driver on HFSQL Classic.
Use
Example of code used to handle the ODBC driver on HFSQL from your Visual .NET program:
--------------------------------------------------------------------
// Sample code for using an HFSQL database by ODBC
namespace ConsoleApplicationTestODBC
{
class Sample
{
public static void Main()
{
try
{
// Connection by using a DSN
// MyODBCDatabase is an ODBC data source defined with odbcad32
// OdbcConnection nwindConn = new OdbcConnection("DSN=MyODBCDatabase");
// Connection by passing the connections parameters directly
// ANA=<Full path of the analysis>
// DIR=<Directory of the files>
OdbcConnection MyConnection =
new OdbcConnection("Driver={HyperFileSQL};ANA=c:\test\\MyAnalysis.wdd;DIR=c:\test\\;");
// Open the connection
MyConnection.Open();
// Query that must be run on the database
OdbcCommand MyQuery = new OdbcCommand("SELECT * FROM MyFile", MyConnection);

// Execute query
OdbcDataReader MyData = MyQuery.ExecuteReader();
// Browse the result of the query
while (MyData.Read())
{
Console.WriteLine("\t{0}\t{1}", MyData.GetInt32(0), MyDatas.GetString(1));
}
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();
}
}
}

--------------------------------------------------------------------
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 05/26/2022

Send a report | Local help