troubleshooting Question

Problem inserting data into firebird table

Avatar of marioway
marioway asked on
DatabasesDelphi
2 Comments1 Solution824 ViewsLast Modified:
Hi, I have a problem inserting data into Firebird tables.

- Connecting to database: no problem
- Using TIBDatabase; TIBTransaction, TIBQuery
- Running first TIBQuery on table 'STRAAT'  1 field with Unique index 'STRATEN'
   
  IBQuery1.Close;              //Straat
  IBQuery1.Prepare;
  IBQuery1.Open;
  IBQuery1.First;
   for i:= 0 to IBQuery1.RecordCount-1 do begin
    ComboBox2.Items.Add(IBQuery1Straten.Value);
    IBQuery1.Next;
   end;

Then by exit ComboBox2

procedure TAdministratie.ComboBox2Exit(Sender: TObject);
var A: string;
begin
with Datamodule1 do begin
 if Trim(ComboBox2.Text) = '' then begin
  Exit;
 end
  else
   begin
    A:= Trim(ComboBox2.Text);
    if not IBQuery1.Locate('Straten', Trim(ComboBox2.Text), [])then begin
      IBQuery5.Close;
      IBQuery5.SQL.Clear;
      IBQuery5.SQL.Add('Insert INTO STRAAT(STRATEN) Values(:A)');
      IBQuery5.Prepare;
      IBQuery5.ExecSQL;
    end
     else
      begin
       Exit;
      end;
  end;
end;
end;

Result is that in the field of the table, data: NULL, instead of the naam of ComboBox2

what might be the problem here ? I know something about SQL-programming, but connot get this right. Can anyone help me on this

thx
Mario
ASKER CERTIFIED SOLUTION
rfwoolf

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 2 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 2 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