PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Example with Microsoft Excel 2007
  • Notes
  • Use example in Crystal Report
  • Use example with Microsoft Visual Studio
  • Use example with C#
  • Example of code that is using the OLE DB provider for HFSQL in C#
  • Use example with PHP
  • Example of code that is using the OLE DB provider for HFSQL in PHP
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Examples for using the OLE DB provider for HFSQL
HFSQLAvailable only with this kind of connection
Example with Microsoft Excel 2007
To use the OLE DB provider for HFSQL in Microsoft Excel 2007:
  1. In Microsoft Excel 2007, go to the "Data" tab, click the "From other sources" button and select "Provenance: Wizard for data connection".
  2. In the "Wizard for data connection" window, choose "Other/Advanced".
  3. In the "Properties of data links" window, in the "Provider" tab, select "PC SOFT OLE DB Provider for HyperFileSQL" and click the "Next" button.
  4. In the "Connection" tab, specify the parameters for connecting to the HFSQL database (Classic or Client/Server).
To access a HFSQL Client/Server database:
  • In the "Data source" edit control, type the name of the HFSQL server (and the port number).
  • In the "User name" control, type the user name that will be used to connect to the HFSQL Client/Server database. If this user has a password, uncheck "Empty password" and check "Allow the password to be saved" and enter the password in the "Password" control.
  • In the "Initial catalog to use" combo box, specify the database name (you will be able to select it in the combo box if the previous parameters have already been typed).
To access a HFSQL Classic database:
  • In the "Data source" edit control, type the full path of.WDD file of analysis description (optional, used to retrieve the integrity constraints).
  • Leave the "User name" and "Password" controls empty.
  • In the "Initial catalog to use" combo box, enter the full path for accessing the data files.
The "Advanced properties" tab allows you to enter the "Extended Properties" element of the connection string if necessary.
Accessing a HFSQL database from Excel

Notes

  • During the test of the connection, an error message with "Persist Security Info (NOT CUSTOMIZABLE)" may appear. This error message must be ignored.
  • Connecting to a HFSQL Client/Server database with a user who has a password:
    When the "Importing data" window is opened at the end of import, make sure that the password was properly stored by Excel.
    To do so, click the "Properties..." button then, in the "Definition" tab, check whether the password is properly saved in the "connection string". The connection string must have the following format (with the password):
    Provider=PCSoft.HFSQL;Initial Catalog=DatabaseName;User ID=User;Data Source=HyperFileSQLServer:4900;Extended Properties="";Initial Catalog=DatabaseName;Password=password
Use example in Crystal Report
To use the OLE DB provider for HFSQL in Crystal Report:
  1. In the wizard for report creation, expand "Create a data source".
  2. Select the "OLE DB (ADO)" sub-option.
  3. In the list of OLE DB providers, select "PC SOFT OLE DB Provider for HyperFileSQL".
  4. Type the elements of connection string (see OLE DB provider for HFSQL for more details).
  5. In the window of "Advanced Information", add a property named "Extended Properties" if necessary:
Use example with Microsoft Visual Studio
To use the OLE DB provider for HFSQL in Microsoft Visual Studio:
  1. In Microsoft Visual Studio, display the server explorer ("Display .. Other windows .. Server explorer").
  2. In the "Server explorer" window, click the "Connect to the database" button.
  3. In "Choose the data source", select "<other>" in the list and "Provider of .NET Framework data for OLE DB" in the "Data provider" combo box then click "Continue".
  4. In the "Add a connection" window, select "PC SOFT OLE DB Provider for HyperFileSQL".
To access a HFSQL Client/Server database:
  • In the "File or server name" edit control, enter the name of the HFSQL server (and the port number).
  • In the "User name" and "Password" controls, enter the information for connecting to the HFSQL server.
  • In the "Initial catalog" list, choose the database.
To access a HFSQL Classic database:
  • In the "File or server name" edit control, enter the full name of the analysis (optional).
  • Leave the "User name" and "Password" controls empty.
  • In the "Initial catalog" list, enter the full path for accessing the data files.
The "Advanced..." button allows you to enter the "Extended Properties" element of the connection string if necessary.
Use example with C#

Example of code that is using the OLE DB provider for HFSQL in C#

public static void Main(string[] args)
{
   // Declare the connection string
   string connectionString = "Provider=PCSOFT.HFSQL;Data Source=dbserver;" +
"User ID=admin;Initial Catalog=mydatabase";

   // Instantiates the OLE DB connection object by passing the connection string to the constructor
   OleDbConnection connect = new OleDbConnection(connectionString);

   // Opens the connection
   connect.Open();

   // Creates and runs a query
   OleDbCommand cmd = new OleDbCommand("SELECT lastname,firstname,CustomerID from customer", connect);
   OleDbDataReader reader = cmd.ExecuteReader();

   // Browses the result of the query and displays the elements on the console
   while (reader.Read())
   {
       int nCustomerID = reader.GetInt32(2);
       Console.WriteLine("{0} - {1} - {2}",reader.GetString(0), reader.GetString(1), nCustomerID);
   }
}
Use example with PHP

Example of code that is using the OLE DB provider for HFSQL in PHP

// Declare the connection string
$ProviderOLEDBHFSQL ='Provider=PCSOFT.HFSQL; Data Source=localhost:4916;'.
' Initial Catalog=CRM; User ID=admin; Password=;';

// Instantiate the object
$ConnectionOLEDBHFSQL  = new COM("ADODB.Connection")
or die("Unable to instantiate an ADO object");

// Connection
$ConnectionOLEDBHFSQL  ->ConnectionString = $ProviderOLEDBHyperFileSQL;
$ConnectionOLEDBFSQL  ->Open();

// Create and run the query
$rs = new COM("ADODB.Recordset");
$sql = "SELECT * FROM CLIENT";
$rs->Open($sql, $ProviderOLEDBHFSQL);

// Browse the result of the query
$index = 0;
while (!$rs->EOF) {

for( $x = 0; $x < $rs->Fields->Count; $x++ )
{
$assoc_array[ $index ][ $rs->Fields[$x]->Name ] = $rs->Fields[$x]->Value;
echo $rs->Fields[$x]->Name ." -> ". $rs->Fields[$x]->Value . "<br>";
}
echo "--------------------------------------------<br>";

$rs->MoveNext();    
$index++;

}
echo $index." listed record(s) <br>";
$rs->Close();
Minimum required version
  • Version 15
This page is also available for…
Comments
Click [Add] to post a comment