Re: Broken SQL
From: John Kebert (johnrkebert_at_AThotmailDOT.com)
Date: 12/20/04
- Previous message: The Swami: "Re: Newbie Question"
- In reply to:(deleted message) nowhere_at_bollocksFilter.com: "Broken SQL"
- Next in thread: J West: "Re: Broken SQL"
- Reply: J West: "Re: Broken SQL"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 20 Dec 2004 00:13:14 -0600
<nowhere@bollocksFilter.com> wrote in message
news:3C++QflGZ7fvsYC=0EXPKWZU6QTO@4ax.com...
>
> I'm not too hot on databases and SQL, and I'm having a bit of grief.
>
> I'm using some TQuery objects to read/write data in some simple
> Paradox tables.
>
> I have one table which consists of these fields:
> Name Type
> ---- ----
> ChangeDate @ (Timestamp)
> UserName A 20
> AuditTrail A 240
>
> I have a procedure that adds an entry to this audit log table, which
> looks something like this:
>
> procedure logEntry(username: string; description : string);
> var
> timeStampStr : string;
> begin
> timeStampStr := DateTimeToStr(Now());
> with DMUdata.auditLogQuery do
> begin
> Close;
> SQL.Clear;
> SQL.Add('INSERT INTO "Audit_log" ');
> SQL.Add(' VALUES ("' + TimeStampStr + '", "' +
> username + '", "' + description +'") ');
> RequestLive := true;
> ExecSQL;
All the talk of datetime formats is great; however, I believe the problem
lies in the following statement. You should not call open on an insert
statement. I suspect if you just delete the "Open" it should work just
fine.
Open; <---- returns a cursor to an insert, you need a select to return
a cursor!
> end;
> end;
My 2 cents..
John
- Previous message: The Swami: "Re: Newbie Question"
- In reply to:(deleted message) nowhere_at_bollocksFilter.com: "Broken SQL"
- Next in thread: J West: "Re: Broken SQL"
- Reply: J West: "Re: Broken SQL"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|