Opening TAdoDataset exceptions: arguments of the wrong type, out of range, or in conflict with each other

I try to debug the following problem for several weeks - this method is called from several places within the same module date, but this exception (from the subject line of this message) occurs only when integers for a specific purpose (orders and orders that we send through the carrier) are used - and do not ask me how the application can distinguish one whole destination from another! In addition, I cannot duplicate this problem on my machine - an error occurs on the warehouse machine, but not on my own development machine, even when working with the same production database. I suspected that there was a conflict of MDAC versions between the two machines, but I launched a version check and confirmed that both machines are working on 2.8, and in addition, confirmed this by registering the TAdoDataset property.Version 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 registration code records a successful operation as follows:


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

Parameter setting.

Ready to set the parameter.

Opened a data set.


But then whenever a pickup order is processed, this exception is thrown whenever a data set is opened:
Version: 2.8

Database Information: (database name and instance)

Parameter setting.

Ready to set the parameter.

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


, , TParameter , . TParameter, - TParameter, , . , - .dfm , . -
select ValueA from TableName where ValueB = @ParameterB

- , , -, - , , , , , , , , , , - . , , , .

+3
4

CodeGear/Embarcadero , / Filter. , -, Filter, , , (, DevExpress TcxGrid, Infopower Filter ..).

- /enablecontrols. , - ( ), .

function TdmESShip.GetESPackageID(const PackageID : Integer): String;
var
  ESPackageID :string; // for debugging
begin
  with qESPackage do
      begin
         ESPackageID := '';
         DisableControls();
         try
            try
               Parameters.ParamByName('PackageID').Value := PackageID;
               Open();
               if NOT(IsEmpty()) then
                 begin
                    ESPackageID := qESPackageESPackageID.AsString;
                 end;
               Close();  // No need to keep open
            except
               on E:Exception do
                  begin
                     ESPackageID := '9999999'; // ex. return a known bogus value
                     // log the error, re-raise a more meaningful error, etc
                  end;
               end;
         finally
            EnableControls();
            Result := ESPackageID;
         end;
     end;
end;

.

+1

ADO + MySQL Delphi 2009. TDateTime, (NOT NULL) . MySQL "0000-00-00 00:00:00" , ADO /. (IIRC ).

, , .

!

0

, . , , SQL ( , SQL) , , .

, ADO , , MS Access. . , SQL, , Access - , , SQL.

0

MySql ODBC Delphi XE. InternalRefresh . , , . . , .

,

INSERT INTO USERS (UserId, Password, Created_at) Values (:UID, :PWD, :CAT)

(TADOQuery), , , .

, .

0

Source: https://habr.com/ru/post/1736009/


All Articles