Monday, July 5, 2010

FAQs – June 2010

Advantage 10 (x64) Fails on Windows 7 / Server 2008 R2

In order to install a service on a Windows 7 or Windows Server 2008 R2 machine the rights must be elevated. The install should automatically elevate it's rights, however, this is not currently working. You can right click on the Advantage 10 x64 install and choose Run as Administrator which will resolve the issue.

A fix for this issue will be available in a service release. This only affects the 64-bit version of the Advantage 10 installer, the 32-bit version elevates rights correctly.

7010 Errors

A 7010 "Problem with Advantage server file read" can occur if there is a corrupt index or memo file associated with the table. When a memo file causes the error the 7010 error may not be reported until the memo file is read or updated. Memo files are not always read upon file open. If you suspect a corrupt memo file when using ADT tables you can use AdtFix to attempt to repair the file.

If the index file is corrupt you will have to delete and rebuild the index. If your table is in a data dictionary and you have set the autocreate property to true, you can delete the index file and reopen the table. Advantage will re-create the index file using the metadata stored in the data dictionary.

Advantage Data Architect (ARC) Does Not Show Up on Screen

ARC saves the last known screen position and size when it is shut down. This is a very convenient feature since ARC will always show up in the same location when opened. However, if you are using a laptop that is normally docked to a dual monitor system ARC may open up off screen when the laptop is undocked. There are a few ways to fix this issue as discussed in this tip.

The latest service release of ARC, version 9.1.0.21, detects that it is positioned outside the current visible area and automatically moves so it can be seen. You can download the latest version of ARC by choosing Check for Updates from the help menu or downloading the latest version from the DevZone.

Derive Parameters for System Procedures

The AdsCommand object has a method called DeriveParameters which will create parameters for the command object. DeriveParameters reads the parameter information from the database making the configuration of these parameters easier. DeriveParameters is used with the StoredProcedure command type.

The DeriveParameters command only worked with stored procedures defined in the data dictionary. In version 10 support was added for the many system procedures as well. See the example below.

// Set the AppID so we can tell the clients apart
using (AdsCommand cmd = cnAds.CreateCommand())
{
  cmd.CommandType = CommandType.StoredProcedure;
  cmd.CommandText = "sp_SetApplicationID";
  cmd.DeriveParameters();
  cmd.Parameters[0].Value = "My Awesome Application";
  cmd.ExecuteNonQuery();
}

This functionality was also added to the latest service release of Advantage 9, version 9.1.0.21 which is available on the DevZone.

Friday, July 2, 2010

ADS 10 Tip # 25 – 64-Bit Clients

Several new 64-bit clients are now available with version 10. These include: ODBC, OLEDB, Linux PHP and the Advantage Local Server. 64-bit versions of the Advantage client DLLs now include a 64 in the name ( i.e. ACE64.dll, AXCWS64.dll ) making them easier to distinguish from their 32-bit versions ( i.e. ACE32.dll, AXCWS32.dll ). 64-bit versions of the .NET Data Provider and Advantage Client Engine (ACE) were available in version 9.

Additionally, improvements have been made to the .NET Data Provider making it easier to target multiple platforms. A .NET application can be compiled using the "Any CPU" target and the Advantage .NET Data Provider will automatically load either ACE32.dll or ACE64.dll depending on the target.

For a complete list of all supported clients and platforms refer to the Advantage Database Server Detailed Supported Platforms document. This is updated regularly and includes information for all Advantage Clients and Servers from version 8 through version 10.

Thursday, July 1, 2010

ADS 10 Tip #24 – Derive Parameters

The AdsCommand object has a CommandType property which can be used to specify the type of command to use. By default the type is Text which means it expects a valid SQL statement. You can use TableDirect to open a table directly and StoredProcedure to run a system or stored procedure.

When using the StoredProcedure command type you can also use the DeriveParameters method to automatically populate the command parameters collection with the input parameters. With the parameters collection populated you can quickly assign their values.

The DeriveParameters method only worked for stored procedures defined in the current database in previous versions. In version 10 support was added for system procedures as well.

// Set the Application ID for the current connection
using (AdsCommand cmd = cnAds.CreateCommand())
{
  cmd.CommandType = CommandType.StoredProcedure;
  cmd.CommandText = "sp_SetApplicationID";
  cmd.DeriveParameters();
  cmd.Parameters[0].Value = "My Application";
  cmd.ExecuteNonQuery();
}