troubleshooting Question

Exiting edit and insert into firebird table gives Dynamic SQL Error

Avatar of marioway
marioway asked on
DatabasesDelphiPascal
9 Comments1 Solution1122 ViewsLast Modified:
Hi, another problem emerged; when I exit an edit(box), and try to insert a value, other then the one allready in the table, it gives me a dynamic SQL Error : Data Type Unknown
Table : 1 field type Char; code:

procedure TAdministratie.ComboBox2Exit(Sender: TObject);
var A: string;
begin
  A := Trim(ComboBox2.Text);
  if A = '' then
  begin
  end
    else
  with Datamodule1 do
  begin
    IBQuery10.Close;
    IBQuery10.SQL.Clear;
    IBQuery10.SQL.Text := 'SELECT 1 from STRAAT WHERE Upper(STRATEN) = Upper(:A)';
    IBQuery10.ParamByName('A').AsString:= A ;
    IbQuery10.Open;
    if not IBQuery10.IsEmpty then
      Exit
    else
    begin
      IBQuery5.Close;
      IBQuery5.SQL.Clear;
      IBQuery5.SQL.Text :=
        'Insert INTO STRAAT (STRATEN) '+
        'SELECT :A As STRATEN FROM rdb$database '+
        'WHERE 0 = ( SELECT COUNT(*) X FROM STRAAT '+
        '  WHERE Upper(STRATEN) = Upper(:A)) ';
      IBQuery5.ParamByName('A').AsString:= A ;
      IBQuery5.ExecSQL;
    end;
  end;
end;

Problem ?
ASKER CERTIFIED SOLUTION
Geert G
Oracle dba
Join our community to see this answer!
Unlock 1 Answer and 9 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 9 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros