Exception opening TAdoDataset: Arguments are of the wrong type, are out of acceptable range, or are

Posted by Dave Falkner on Stack Overflow See other posts from Stack Overflow or by Dave Falkner
Published on 2010-03-08T21:24:41Z Indexed on 2010/03/08 21:51 UTC
Read the original article Hit count: 317

Filed under:
|
|

I've been trying to debug the following problem for several weeks now - this method is called from several places within the same datamodule, but this exception (from the subject line of this post) only occurs when integers for a certain purpose (pickup orders vs. orders that we ship through a carrier) are used - and don't ask me how the application can tell the difference between one integer's purpose and another! Furthermore, I cannot duplicate this issue on my machine - the error occurs on a warehouse machine but not my own development machine, even when working with the same production database. I have suspected an MDAC version conflict between the two machines, but have run a version checker and confirmed that both machines are running 2.8, and additionally have confirmed this by logging the TAdoDataset's .Version property at runtime.

function TdmESShip.SecondaryID(const PrimaryID : Integer ): String;
begin
    try
      with qESPackage2 do
        begin
          if Active then
              Close;
          LogMessage('-----------------------------------');
          LogMessage('Version: ' + FConnection.Version);
          LogMessage('DB Info: ' + FConnection.Properties['Initial Catalog'].Value + ' ' +      FConnection.Properties['Data Source'].Value);
          LogMessage('Setting the parameter.');
          Parameters.ParamByName('ParameterName').Value := PrimaryID;
          LogMessage('Done setting the parameter.');
        Open;

Ninety-nine times out of 100 this logging code logs a successful operation as follows:


Version: 2.8 DB Info: (database name and instance)

Setting the parameter.

Done setting the parameter.

Opened the dataset.


But then whenever a "pickup" order is processed, this exception gets thrown whenever the dataset is opened:
Version: 2.8

DB Info: (database name and instance)

Setting the parameter.

Done setting the parameter.

GetESPackageID() threw an exception. Type: EOleException, Message: Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another Error: Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another for packageID 10813711


I've tried eliminating the parameter and have built the commandtext for this dataset programmatically, suspecting that some part of the TParameter's configuration might be out of whack, but the same error occurs under the same circumstances. I've tried every combination of TParameter properties that I can think of - this is the millionth TParameter I've created for my millionth dataset, and I've never encountered this error. I've even created a second dataset from scratch and removed all references to the original dataset in case some property of the original dataset in the .dfm might be corrupted, but the same error occurs under the same circumstances. The commandtext for this dataset is a simple

select ValueA from TableName where ValueB = @ParameterB

I'm about ready to do something extreme, such as writing a web service to look these values up - it feels right now as though I could destroy my machine, rebuild it, rewrite this entire application from scratch, and the application would still know to throw an exception whenever I try to look up a secondary value from a primary value, but only for pickup orders, and only from the one machine in the warehouse, but I'm probably missing something simple. So, any help anyone could provide would be greatly appreciated.

© Stack Overflow or respective owner

Related posts about delphi

Related posts about 2007