Discuss Inserting Data into Databases in the Delphi Programming forum on Dev Shed. Inserting Data into Databases Delphi Programming forum discussing Delphi related topics including Kylix, C++ Builder, and more. Delphi is a high-performance language, originally based on the PASCAL language.
Posts: 5
Time spent in forums: 56 m 22 sec
Reputation Power: 0
Inserting Data into Databases
Hi, Im having trouble adding my data into databases. I'm using the following code:
adotList.Append;
adotList['FixtureID'] := FixId;
adotList['OpponentID'] := OppId;
adotList['CompID'] := CompId;
adotList['FixtureDate'] := FixDate;
adotList['Venue'] := Ven;
adotList.Post;
if Ven = 'A'
then
begin
adotOpponent.Append;
adotOpponent['OpponentID'] := OppId;
adotOpponent['Opponent'] := ledtOpponent.Text;
adotOpponent['Address'] := ledtAddress.Text;
adotOpponent.Post;
end
else
begin
adotOpponent.Append;
adotOpponent['OpponentID'] := OppId;
adotOpponent['Opponent'] := ledtOpponent.Text;
adotOpponent.Post;
end;
adotComp.Append;
adotComp['CompID'] := CompId;
adotComp['Competition'] := ledtCompetition.Text;
adotComp.Post;
end;
When I press the Add Button only the data for the List table is being entered, The error Message is ' You cannot change or add a record because a related record is required in table 'Competition'. Also When I close the application the data that does get entered is being saved into my database.