Board index » delphi » How To update Memo fieds using query ?

How To update Memo fieds using query ?

Hello everyone!
I use TQuery to insert and update a table.
I have no problem with insert statement, but with Update statement.
Here is a short description: Capabilities not support.
Here is the codes
    With qryResAllInfo,sql DO Begin
      DisableControls;
      iP := 0;Clear;Active := False;Unprepare;Add(sSQL);
      sSQL :=
        'Update ResidentAllRetInfo SET '+
        'DependentBenefit = :pDependentBenefit '+
        'Where (SocSecNo = :pKeySSN) ';
      Params[0].AsMemo :=
qryResident.FieldByName('DependentBenefit').AsString;// Problem here
      Params[1].AsString := sSSN;
      Try
        Prepare;ExecSQL;
      Except on E: Exception do
        Begin
        end;// Begin
      End; // end Try
      EnableControls;
    End; // With

Thanks you all

Sincerely yours

Tin Le

 

Re:How To update Memo fieds using query ?


Quote
On Tue, 28 Mar 2000 09:18:26 -0800, "TinLe" <tinle...@msn.com> wrote:
>I use TQuery to insert and update a table.
>I have no problem with insert statement, but with Update statement.
>Here is a short description: Capabilities not support.

[...]

Works for me. What version of Delphi are you using? Version of the
BDE?

(Follow-ups to the newsgroup only, please.)
\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\
Steve Koterski                    "If you aren't fired with
Technical Publications            enthusiasm, you will be
Borland                           fired with enthusiasm."
                              -- Vince Lombardi (1913-1970)

Re:How To update Memo fieds using query ?


Quote
>Works for me. What version of Delphi are you using? Version of the BDE?

I am using Delphi5 With Update Pack1 And Paradox DBE > 5.01
I have Successfully using insert statement, but not using Update statement
I even tired to use Params[iP].AsString,Params[iP].Value,Params[iP].AsMemo
but the message still said (Capability not supported);
Is there anything I need to make it work? Thanks you
Tin Le

This is actual codes that I work with
   If Not blExisted Then  // Insert a new record to the database
      Begin sSQL :=
        'Insert Into ResidentAllRetInfo Values('+
          ':pResidentKey, '+
          ':pSocSecNo, '+
          ':pFullName, '+
          ':pDependentBenefit, '+ // Memo field
          ':pDa{*word*249}ter, '+
          ':pServicePerson ) ';
      End // Begin
    Else If blExisted Then  // Modify current record of the database
      Begin sSQL :=
        'Update ResidentAllRetInfo SET '+
        'FullName = :pFullName, '+
        'DependentBenefit = :pDependentBenefit, '+ // Memofiled
        'ServicePerson    = :pServicePerson '+
        'Where (SocSecNo  = :pKeySSN) ';
      End; // Begin
    With qryResAllInfo,sql DO Begin
      DisableControls;
      iP := 0;Clear;Active := False;Unprepare;Add(sSQL);
      If Not blExisted Then
        Begin
          Params[iP].AsString := IntToStr(iKey);Inc(iKey);Inc(iP); //
ResidentKey;
          Params[iP].AsString := sSSN;Inc(iP); // Social security no
        End; // Add a new record to the database
      Params[iP].AsString :=
qryResident.FieldByName('FullName').AsString;Inc(iP);
      Params[iP].AsMemo   :=
qryResident.FieldByName('DependentBenefit').AsString ;Inc(iP);
      Params[iP].AsString := 'Ariel';Inc(iP);
      If blExisted Then Begin Params[iP].AsString := sSSN;Inc(iP);End;//
Modify current record of the database
      Try
        Prepare;ExecSQL;
      Except on E: Exception do
        begin
          Screen.Cursor := crDefault;
          ShowMessage('InsertEditResidentAllInfo: ' +E.Message);
        end;// Begin
      End; // end Try
      EnableControls;
    End; // With

Re:How To update Memo fieds using query ?


Quote
>I am using Delphi5 With Update Pack1 And Paradox DBE > 5.01
>I have Successfully using insert statement, but not using Update statement

I know memo update via SQL was broken in BDE 5.01
I do not remember retesting it in BDE 5.1 but you may want to get that update
and give it a try.

--
Brian Bushay (TeamB)
Bbus...@NMPLS.com

Re:How To update Memo fieds using query ?


Thanks you, Brian Bushay

Quote
>...SQL was broken in BDE 5.01
>...get that update and give it a try>

Well it turned out that Insert/Update statement in TQuery did not work when
using
Params[Integer..].AsMemo := 'Something here';
But used as Params[Integer..].AsString := 'Big long string here...';
It worked for Insert but the contents came out weird things and sure
it did not work for Update.

Yes, I have BDE version 5.01. I am going to update to the BDE > 5.01
and I will let everyone know.

Thanks you again

Sincerely yours

Tin Le

I though I know but as it turned out, I know only what I know
and the rest I would ask and learn from expert people around the word.

Re:How To update Memo fieds using query ?


Thanks again Brain,

Yes, I update the new BDE 5.1.1 and it is working for both Insert/Update
Yes use Params[...].AsMemo := 'Big long strings ....'; It works really good

Thanks you all every one get involved.

ALL of Your helps are appreciated.

Best regards

Tin Le

Other Threads