Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 7249
  • Last Modified:

What does the following error mean?

MyApplication.exe is a Delphi 5 app that creates and outputs and EDI file.  The processing in the app outputs to a debug file, which is where I receive the exception.

Exception
Exception EOleSysError in module MyApplication.exe at 00061D4A.  No named arguments.

MyApplication.exe is running on a terminal services desktop with Windows Server 2008 (64 bit).

I need to know if there is a missing entry in the registry, missing dll files, etc.
unit Main;
 
interface
 
uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, Db, ADODB, ExtCtrls, ComCtrls, Registry, Mask, ToolEdit, IniFiles,
  Buttons;
 
type
 
  TForm1 = class(TForm)
    ADOConnection1: TADOConnection;
    ADODataSet1: TADODataSet;
    ADODataSet2: TADODataSet;
    ADODataSet3: TADODataSet;
    ADODataSet4: TADODataSet;
    Panel1: TPanel;
    Panel2: TPanel;
    Panel3: TPanel;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    ComboBox1: TComboBox;
    ComboBox2: TComboBox;
    ComboBox3: TComboBox;
    ComboBox4: TComboBox;
    Button2: TButton;
    Label5: TLabel;
    Label6: TLabel;
    Label7: TLabel;
    Label8: TLabel;
    Label9: TLabel;
    Animate1: TAnimate;
    Label11: TLabel;
    Label12: TLabel;
    Panel4: TPanel;
    Label13: TLabel;
    Label14: TLabel;
    Label15: TLabel;
    Label16: TLabel;
    Button1: TButton;
    Label17: TLabel;
    RadioGroup1: TRadioGroup;
    Button3: TButton;
    OpenDialog1: TOpenDialog;
    Qry: TADOQuery;
    OutDirEdit : TEdit;
    DirBtn: TSpeedButton;
    ProgBar: TProgressBar;//Can only be used with Delphi label component
    //Label18: TTierLabel;  Needs to be Delphi label, not TIER
    //Label19: TTierLabel;  Needs to be Delphi label, not TIER
    procedure Button2Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure ComboBox1Change(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Label1DblClick(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    function FindPayorDir( PayorID : integer ) : string;
    procedure DirBtnClick(Sender: TObject);
 
  private
      BatchKey : Integer;
      MapNameID : Integer;
      TransID : Integer;
      PayorID : Integer;
      ConnectionStr : string;
      V1Builder : Boolean;
      V2Builder : Boolean;
      UserDir   : string;
      IniFile: TIniFile;
      IsIniUsed, IsParUsed : Boolean;
      EDIOutputDir : String;
      ConnectionStr2 : String;
 
    { Private declarations }
  public
     //Can only be used with Delphi labels
     //procedure setMinMax(AMin : Integer; AMax : Integer);
     //procedure UpdatePrg;
    { Public declarations }
  end;
 
const
  WM_ACK = WM_USER + 1;
 
var
  Form1: TForm1;
 
implementation
 
uses BuildEdiSpc, FileVersion, BuildEdiSpc2;
 
{$R *.DFM}
 
procedure TForm1.Button2Click(Sender: TObject);
var
Total : integer;
Pass : integer;
Fail : Integer;
FName : string;
begin
 
  if ( ComboBox1.ItemIndex <> - 1 ) then
     PayorID := Integer(ComboBox1.Items.Objects[ComboBox1.ItemIndex]);
 
  if ( ComboBox2.ItemIndex <> - 1 ) then
     MapNameID := Integer(ComboBox2.Items.Objects[ComboBox2.ItemIndex]);
 
  if ( ComboBox3.ItemIndex <> - 1 ) then
     TransID := Integer(ComboBox3.Items.Objects[ComboBox3.ItemIndex]);
 
  if ( ComboBox4.ItemIndex <> - 1 ) then
     BatchKey := Integer(ComboBox4.Items.Objects[ComboBox4.ItemIndex]);
 
  Panel3.BringToFront;
  V2Builder := True;
 
  Animate1.Visible := False;
  Animate1.Active := False;
 
end;
 
 
procedure TForm1.FormCreate(Sender: TObject);
var
UserName : string;
UserPass : string;
Database : string;
MyProvider : string;
Server : string;
V1, V2, V3, V4 : Word;
Reg : TRegistry;
IniSec: string;
CurrentDir : string;
 
begin
 
    V1Builder := False;
    V2Builder := True;
    BatchKey := -1;
    MapNameID := -1;
    TransID := -1;
    PayorID := -1;
    Label6.Caption := '';
    Label9.Caption := '';
    Label11.Caption := '';
    Label12.Caption := '';
    RadioGroup1.Visible := False;
    RadioGroup1.ItemIndex := 1;
    Reg := TRegistry.Create;
    Reg.RootKey := HKEY_LOCAL_MACHINE;
    OutDirEdit.Text := '';
    ConnectionStr2 := '';
    IsIniUsed := False;
    IsParUsed := False;
 
    ADOConnection1.Close;
    
    with ADOConnection1 do
    begin
 
      ConnectionString := ConnectionStr;
 
      IsIniUsed := ReadLoginwINI( UserName, UserPass, Database, Server, MyProvider );
      IsParUsed := ReadLoginwPAR( UserName, UserPass, Database, Server, MyProvider );
 
      if ( UserName <> '' ) and ( Database <> '' ) and ( UserPass <> '' ) and ( Server <> '' ) and ( MyProvider <> '' ) then
      begin
        ConnectionString := Format('Provider=%s;Password=%s;Persist Security Info=True;User ID=%s;Initial Catalog=%s;Data Source=%s;Packet Size=4096',[MyProvider,UserPass,UserName,Database,Server]);
      end;
 
      CurrentDir := IncludeTrailingBackslash(ExtractFilePath(Application.ExeName));
 
      OutDirEdit.Text := CurrentDir;
 
      if ( FileExists(CurrentDir + 'EdiBuilder.udl') = True ) then
      begin
        ConnectionString := Format('FILE NAME=%sEdiBuilder.UDL', [CurrentDir]);
        AdoConnection1.ConnectionString := ConnectionString;
        Label17.Caption := ConnectionString;
 
        //Comment out-testing only//
        //ConnectionStr := ConnectionString;
        //Comment out-testing only//
 
      end;
 
      if ( ConnectionString = '' ) then
      begin
 
        //01.18.2006 TIER 4.0.77 outputs connection info in Parameter 5 D.L.
        if Pos('Provider', ParamStr(5)) > 0 then
        begin
          AdoConnection1.ConnectionString := ParamStr(5);
          Label17.Caption := ParamStr(5);
          ConnectionStr2 := ParamStr(5);
          OutDirEdit.Text := CurrentDir;   //always specify the directory EdiBuilder executes from
        end;
 
        //01.18.2006 Other versions of TIER may use Parameter 6 D.L.
        if Pos('Provider', ParamStr(6)) > 0 then
        begin
          AdoConnection1.ConnectionString := ParamStr(6);
          Label17.Caption := ParamStr(6);
          ConnectionStr2 := ParamStr(6);
          OutDirEdit.Text := CurrentDir;  //always specify the directory EdiBuilder executes from
        end;
 
      end;
 
      Label17.Visible := False;
 
      //BatchKey := 1053328;  //Comment out after testing//
 
    end; //end with adoconnection
 
    try
        AdoConnection1.Open;
    except
        ShowMessage('Failed to connect to SQL Server');
        exit;
    end;
 
    { handle param 2,3,4 via EdiBuilder.par file - START}
    IniFile := TIniFile.Create(ExtractFilePath(ParamStr(0)) + 'EdiBuilder.par');
 
    Qry.Close;
    Qry.SQL.Clear;
    Qry.SQL.Add(Format('SELECT OutputTypeLU FROM BIL_Batches WHERE BatchKey = %d', [BatchKey]));
    Qry.Open;
    if Qry.FieldByName('OutputTypeLU').AsInteger = 3 then
      IniSec := 'Medicare'
    else
      IniSec := 'Medicaid';
 
    //comment out after testing//
    //MapNameID := 49;
    //TransID := 1;
    //PayorID := 316998;
    //comment out after testing//
 
    //uncomment after testing//
    MapNameID := IniFile.ReadInteger(IniSec, 'MapNameID', -1);
    TransID := IniFile.ReadInteger(IniSec, 'TransID', -1);
    PayorID := IniFile.ReadInteger(IniSec, 'PayorID', -1);
    //uncomment after testing//
 
    { handle param 2,3,4 via EdiBuilder.par file - END}
 
    Animate1.Visible := False;
    Animate1.Active := False;
 
    GetBuildInfo( ParamStr(0), V1, V2, V3, V4 );
 
    Caption := Caption + ' ' + Format('%d.%d.%d',[V1,V2,V3]);
 
    if ( ParamCount > 1 ) then
    begin
 
      //Comment out after testing//
      //BatchKey := 1053328;
      //Label6.Caption := IntToStr(Batchkey);
      //Label6.Update;
      //Label9.Caption := IntToStr(BatchKey) + '.837';
      //Comment out after testing//
 
 
      //uncomment out after testing//
      BatchKey := StrToInt( ParamStr(1) );
      Label6.Caption := ParamStr(1);
      Label6.Update;
      Label9.caption := ParamStr(1) + '.837';
      //uncomment out after testing//
 
      if ( OutDirEdit.Text <> '' ) then
      OutDirEdit.Text := FindPayorDir( PayorID );
 
      if ( ParamCount = 5 ) or ( ParamCount = 7 )  then
      begin
 
        Label6.Caption := ParamStr(1);
        Label6.Update;
        Label9.caption := ParamStr(1) + '.837';
        OutDirEdit.Text := FindPayorDir( PayorID );
 
        Application.ProcessMessages;
 
        BatchKey := StrToInt( ParamStr(1) );
 
        if ( ParamCount > 2 ) then
        begin
          PayorID := StrToInt( ParamStr(3) );
 
          if ( FindPayorDir( PayorID ) <> '' ) then
               OutDirEdit.Text := FindPayorDir( PayorID );
 
        end;
 
        if ( ParamCount > 3 ) then
             MapNameID := StrToInt( ParamStr(4) );
        if ( MapNameID = -1 ) then
             MapNameID := IniFile.ReadInteger(IniSec, 'MapNameID', -1);
 
 
        if ( ParamCount > 4 ) then
             TransID := StrToInt( ParamStr(5) );
        if ( TransID = -1 ) then
             TransID := IniFile.ReadInteger(IniSec, 'TransID', -1);
        
 
        ConnectionStr := '';
 
        if ( ParamCount > 5 ) then
             ConnectionStr := ParamStr(6);
 
        Panel3.BringToFront;
        Panel3.Update;
 
        Application.ProcessMessages;
 
        Animate1.Visible := False;
 
        exit;
 
      end;
 
      if ( ParamCount >= 2 ) then
           SendMessage ( StrToInt(ParamStr(2)), WM_ACK, 0, 0 );
 
      Application.ProcessMessages;
 
    end;
 
    ComboBox1.Items.Clear;
    ComboBox3.Items.Clear;
 
    with ADODataSet1 do
    begin
       Open;
       First;
       ComboBox1.Items.Clear;
       while ( not eof ) do
       begin
          ComboBox1.Items.AddObject( FieldByName('PayorName').AsString, TObject( FieldByName('PayorKey').AsInteger ) );
          Next;
       end;
       Close;
    end;
 
    //original - uncomment after testing//
 
    with ADODataSet2 do
    begin
      Close;
      Parameters.ParamByName('Key').Value := PayorID;
      Open;
      First;
      ComboBox2.Items.Clear;
      while ( not eof ) do
      begin
        ComboBox2.Items.AddObject( FieldByName('MapName').AsString, TObject( StrToInt(FieldByName('EdiMapNameID').AsString) ) );
        Next;
      end;
      Close;
    end;
    //original - uncomment after testing//
    
 
    //select Description, EDIMapTransactionID from EDI_Map_Transaction
 
    with ADODataSet3 do
    begin
       Close;
       Parameters.ParamByName('TransID').Value := TransID;
       Open;
       ComboBox3.Items.Clear;
       while ( not eof ) do
       begin
          ComboBox3.Items.AddObject( FieldByName('Description').AsString, TObject( FieldByName('EdiMapTransactionID').AsInteger ) );
          Next;
       end;
       Close;
    end;
 
    
 
    with ADODataSet4 do
    begin
       Open;
       First;
       ComboBox4.Items.Clear;
       while ( not eof ) do
       begin
         ComboBox4.Items.AddObject( FieldByName('BatchKey').AsString, TObject( FieldByName('BatchKey').AsInteger ) );
         Next;
       end;
       Close;
    end;
 
 
    if ( PayorID <> -1 ) then
       ComboBox1.ItemIndex := ComboBox1.Items.IndexOfObject( TObject(PayorID) );
 
    if ( MapNameID <> -1 ) then
       ComboBox2.ItemIndex := ComboBox2.Items.IndexOfObject( TObject(MapNameID) );
 
    if ( TransID <> -1 ) then
       ComboBox3.ItemIndex := ComboBox3.Items.IndexOfObject( TObject(TransID) );
 
    if ( BatchKey <> -1 ) then
       ComboBox4.ItemIndex := ComboBox4.Items.IndexOfObject( TObject(BatchKey) );
 
end;   
 
 
procedure TForm1.ComboBox1Change(Sender: TObject);
var
PayorKey : Integer;
begin
 
  ComboBox2.Items.Clear;
 
  if ( ComboBox1.ItemIndex = -1 ) then exit;
 
  PayorKey := Integer( ComboBox1.Items.Objects[ ComboBox1.ItemIndex] );
 
    with ADODataSet2 do
    begin
       Close;
       Parameters.ParamByName('Key').Value := PayorKey;
       Open;
       while ( not eof ) do
       begin
          ComboBox2.Items.AddObject( FieldByName('MapName').AsString, TObject( FieldByName('EdiMapNameID').asInteger ) );
          Next;
       end;
       Close;
    end;
 
 
end;
 
procedure TForm1.Button1Click(Sender: TObject);
begin
  Application.Terminate;
end;
 
procedure TForm1.Label1DblClick(Sender: TObject);
begin
    Label17.Visible := True;
end;
 
 
procedure TForm1.Button3Click(Sender: TObject);
var
Total : integer;
Pass : integer;
Fail : Integer;
FName : string;
begin
 
   FName := '';
 
   if ( OutDirEdit.Text <> '' ) then
     FName := OutDirEdit.Text;
 
   if ( ConnectionStr2 <> '' ) then
     ConnectionStr := ConnectionStr2;
 
   //ProgBar.Visible := True;  Can only be used with Delphi label
 
   Animate1.Visible := True;
   Animate1.Active := True;
 
   LoadEDI2( BatchKey, MapNameID, PayorID, TransID, ConnectionStr, Total, Pass, Fail, FName );
 
   Animate1.Visible := False;
   Animate1.Active := False;
 
   Sleep(250);
 
   Panel4.BringToFront;
 
   Label13.Caption := 'Total Transactions ' + IntToStr( Total );
   Label14.Caption := 'Total Pass Transactions ' + IntToStr( Pass );
   Label15.Caption := 'Total Fail Transactions ' + IntToStr( Fail );
   Label16.Caption := 'Output file name ' + FName;
 
   SendMessage ( StrToInt(ParamStr(2)), WM_ACK, 0, 0 );
 
end;
 
 
function TForm1.FindPayorDir( PayorID : integer ) : string;
var
Reg : TRegistry;
iIndex : integer;
Entries : TStringList;
begin
 
    Result := GetCurrentDir;
 
    Entries := TStringList.Create;
 
    Reg := TRegistry.Create;
    Reg.RootKey := HKEY_LOCAL_MACHINE;
    Reg.OpenKey('\Software\Sequest Technologies\Tier\EdiBuilder', False );
    Reg.GetKeyNames( Entries );
 
    for iIndex := 0 to Entries.count -1 do
    begin
         if (Reg.OpenKey('\Software\Sequest Technologies\Tier\EdiBuilder\'+ Entries[iIndex], False ) ) then
         begin
              if ( Reg.ValueExists('PayorID') ) then
              begin
                   if ( PayorID = Reg.ReadInteger('PayorID') ) then
                   begin
                       Result := Reg.ReadString('OutputDir');
                       Reg.CloseKey;
                       exit;
                   end;
              end;
         end;
    end;
 
    Entries.Free;
 
    Reg.CloseKey;
 
end;
 
 
procedure TForm1.DirBtnClick(Sender: TObject);
var ExpandedName : String;
begin
  with OpenDialog1 do begin
    OpenDialog1.Title := 'Select Output Directory';
    ExpandedName := OutDirEdit.Text;
    InitialDir := ExpandedName;
    Filename := '(this folder)';
 
    if Execute then
    begin
      OutDirEdit.Text := ExtractFilePath(FileName);
      EDIOutputDir := OutDirEdit.Text;
    end;
 
  end;
 
end;
 
 
{Can only be used with Delphi label
procedure TForm1.setMinMax(AMin : Integer; AMax : Integer);
begin
  ProgBar.Min := AMin;
  ProgBar.Max := AMax;
end;
 
procedure TForm1.UpdatePrg;
begin
  ProgBar.Position := ProgBar.Position + 1;
  Application.ProcessMessages;
end;
}
 
 
 
end.

Open in new window

DebugEdi.TXT
0
SequestTech
Asked:
SequestTech
2 Solutions
 
ziolkoCommented:
my first guess would be that there's error initializing ADO, make sure you use appropriate provider and latest MDAC is installed

ziolko.
0
 
SteveBayCommented:
Some thought:

For starters I woud  avoid having a TDataSet.Open that was not inside of a try/except block.
i.e:
try
  Qry.Open;
except
  on e : exception do begin
    ShowMessage('Error Opening Qry:' + e.exception);
    Result := False ; // on anything wlse that makes sence here
end;

This will help you determine which call is raising the exception.

Second: While the error message is not quite consistent with this - I would set Qry.ParamCheck = False;  just to be sure that you are not getting erroneous parameters placed in your Qry.SQL if BatchKey were to contain a ":"


0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now