Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 5 of 5 total
Thread Example of Inserting records at RUNTIME
Sun, Jul 29 2007 5:27 AMPermanent Link

Koos Loots
Where can I see an example of inserting a record at runtime after creating a table. I tried this but getting a error messsge

with InitialiseQuery do
     begin
     SQL.Text := 'SELECT * FROM TaxPayer';
     Open;
     if (RecordCount = 0) then
        begin
        Close;
        SQL.Clear;
        SQL.Add('INSERT INTO "TaxPayer" (TaxRefNo, TaxYear, IDNo, PassportNo, Surname, Name, Initials,');
        SQL.Add('IsMarried, IsICOP, IsOOCOP, CellNo, HTel, Fax, BusTel, PAddress1, PAddress2, PAddress3,');
        SQL.Add('PCode, RAddress1, RAddress2, RAddress3, RCode, WAddress1, WAddress2, WAddress3, WCode, TaxDate, Comments)');
        SQL.Add(' VALUES ("0553/365/56/6", 2007, "620103 6565 020", NULL, "Loots",');
        SQL.Add('"Koos", "JJ", True, True, False, "082 301 4755", NULL, NULL,');
        SQL.Add('"(011)310 4452", "P.O. Box 45787", "Helderkruin", NULL, 1733,');
        SQL.Add('"16 Boerneef Street", "Florida", "Roodepoort", 1733, "ABSA Towers North 2E1", "Johannesburg", 2000, 27/07/2007, "KKKKK")');
        ExecSQL;
        end
     else
        Close;
     end;

The error message I received:
Project PaerTAX.exe raised exception class EEDBException with message 'ElevateDB Error #700 An error was found
in the statement at line 4 and column 10 (Expected column name but instead found "0553/365/56/6")'.

Help please.
Sun, Jul 29 2007 6:21 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Koos


Double quotes for field names etc Single quotes for data

Roy Lambert
Sun, Jul 29 2007 10:10 AMPermanent Link

Koos Loots
Roy Lambert <roy.lambert@skynet.co.uk> wrote:

Koos


Double quotes for field names etc Single quotes for data

Roy Lambert
--------------------------------------------------------

Roy,

Thanks for the help. Works 100%.

Regards
Koos

Wed, Oct 29 2008 1:33 PMPermanent Link

Daniel Kram
INSERT INTO "tblPaymentTypes"
("OriginalINIValue","Description","OrderInList","GLCreditAccount","GLDebitAccount","Active")
VALUES (4,'Credit Card',4,'','',1)

The above statement works fine in the DB Manager, but not through a Delphi EDBQuery
I receive error 700
   with (p_qryWorking) do
   begin
       if (Active) then
       begin
           Close;
       end;
       Sql.Clear;
       // add any tracing of SQL here
       SQL.Add(p_sSQL);
       try
         ExecSQL;
       except
       on E: EDatabaseError do
         // cannot drop table because does not exist or no permission
         if (pos('3701',E.Message) > 0) then
           // do nothing, this is okay
         else begin
           ShowMessage(E.ClassName+' error raised, with message : '+E.Message
                      + CRLF
                      + 'SQL statment:'
                      + CRLF
                      + p_sSQL
                      );
           // some other error
           Raise;
         end;
       end;
   end;  // with
   Result := True;
end;
Wed, Oct 29 2008 2:14 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Daniel,

<< The above statement works fine in the DB Manager, but not through a
Delphi EDBQuery I receive error 700 >>

What is the actual error message that you're seeing ?  It should tell you at
what line and column the error is ?

--
Tim Young
Elevate Software
www.elevatesoft.com

Image