From: | Raymond O'Donnell <rod(at)iol(dot)ie> |
---|---|
To: | 'PostgreSQL' <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Update a Value From TEdit |
Date: | 2007-04-13 18:25:55 |
Message-ID: | 461FCB33.3060308@iol.ie |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 13/04/2007 19:05, Bob Pawley wrote:
> I am attempting to update a table using a value that
> is displayed on a TEdit component. I am getting an
> access violation error.
Hi Bob,
An access violation error means that some part of your code is trying to
access memory that it shouldn't. It most likely means that you're trying
to use a component that hasn't yet been created, so it's a bug in your
code rather than a problem with PostgreSQL.
> PSQLQuery1.Close;{close the query}
> //assign new SQL expression Monitor
> PSQLQuery1.SQL.Clear;
> PSQLQuery1.SQL.Add ('Update P_ID.Loops');
> PSQLQuery1.SQL.Add ('Set IDW_Loop_ID = + LoopNumberEdit');
> PSQLQuery1.SQL.Add ('Where P_ID.Loops.Loop_Name = :Loop_Name');
> PSQLQuery1.ParamByName('LoopNumberEdit').Value := Edit1.Text;
> PSQLQuery1.Execsql;
How do you create PSQLQuery1? - Did you drop it on the form at
design-time, or have you created it on-the-fly in your code? If the
latter, then that's probably your problem - have you called
PSQLQuery1.Create() somewhere before the code above executes?
However, if PSQLQuery1 was created at design time, then the problem lies
elsewhere. Look for some component which you've declared, but whose
constructor you haven't invoked.
BTW, from the code above it seems you're passing in an integer value to
the query; I prefer to use ParamByName().AsInteger as an extra layer of
safety, to ensure that an integer acyually does get passed in.
Ray.
---------------------------------------------------------------
Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland
rod(at)iol(dot)ie
---------------------------------------------------------------
From | Date | Subject | |
---|---|---|---|
Next Message | Raymond O'Donnell | 2007-04-13 18:33:25 | Re: Update a Value From TEdit |
Previous Message | Kynn Jones | 2007-04-13 18:23:25 | OT: schema-sketching software |