Wednesday, July 1, 2009

FAQs – June 2009

Does Advantage Support the Microsoft Entity Framework

Yes, support for the Entity Framework was added to the latest service release of the Advantage .NET Data Provider ( The Microsoft Entity Framework is included as part of ADO.NET 3.5 and is included with Visual Studio 2008 SP1. You can read my brief introduction to the framework in this post. I also recommend that you take a look at the articles on MSDN.

There is also a screencast which shows a quickstart of using the Entity Framework with Advantage.

How Much Memory does the cache system use

On a 32-bit system 256MB of memory are allocated to the cache system. On a 64-bit system the size of the cache allocation is calculated by the Advantage service.

The cache size will never exceed 85% of the total physical memory and it will never exceed the current available memory on the system. The allocation size has a buffer which prevents it from using all available memory on the system. In general the cache allocation is much lower than the amount of physical memory.

With both the 32-bit and 64-bit versions of Advantage the amount of cache allocated is configurable by changing the MAX_CACHE_MEMORY registry setting.

Upgrading an Advantage License

There are times when you need to expand a current license of Advantage which requires you to enter a new validation code. There is a graphical utility available on for the Windows Version of Advantage which allows you to enter the new validation code called the ADS Stamp Utility. This utility is located in the server directory (C:\Program Files\Advantage 9.10\Server) and is called adsstamp.exe. Click on the License button to enter your new validation code and/or replication code.


The utility is also available on Linux as a command line utility. It is located in the Advantage install directory and it is run using the following command line: ./adsstamp –prompt.

Adsstamp Linux

Handling NULL with .NET Data Provider

When working with tables which may contain NULLs with any .NET Data Provider you must check for the NULL before assigning the result to a control. This is most evident when using a DataReader and looping through the table. When you reach a record that contains a NULL you may get an error like the following.

 Null Error

You can avoid this error by using the DBNull class in .NET or if you are using an Advantage DataReader you can use the IsDBNull function. An example of using IsDBNull is below:

   1: AdsCommand cmd;
   2: cmd = conn.CreateCommand();
   3: cmd.CommandText = "SELECT * FROM Table";
   5: AdsDataReader dr;
   6: dr = cmd.ExecuteReader();
   8: while (dr.Read())
   9: {
  10:    if (!dr.IsDBNull(7))
  11:        cboBox.Items.Add(dr.GetDateTime(7).ToShortDateString());
  12:    else
  13:        cboBox.Items.Add("Null Date");
  14: }

No comments: