Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Closed Thread
 
Thread Tools Display Modes
  #1  
Old 03-20-2013, 10:55 AM
Zaaka Zaaka is offline
Senior Member
 
Join Date: Aug 2002
Location: Teesside, UK
Posts: 217
Default TRichedit to MSAccess Database

Hi all,

I have a Access database which I have connected to via a TADOQuery, which is working fine, however I need to read and update a 'LongText' or BLOB with the contents of a TRichedit, can this be done using an ADOQuery?

Some code would be really appreciated.
  #2  
Old 03-20-2013, 03:45 PM
Jasser Jasser is offline
Moderator
 
Join Date: Jan 2005
Location: Saudi Arabia
Posts: 5,060
Default

Try:


Code:
//To load it.
RichEdit1.Lines.Text := ADOQuery1['LongTextField'];


//To save it back to the DB.
ADOQuery1.Edit;
ADOQuery1['LongTextField'] := RichEdit1.Lines.Text;
ADOQuery1.UpdateBatch(); //or Post.
__________________
Regards,
Abdulaziz Jasser
  #3  
Old 03-21-2013, 09:42 AM
Zaaka Zaaka is offline
Senior Member
 
Join Date: Aug 2002
Location: Teesside, UK
Posts: 217
Default

Thanks Jasser I have tried the code but get the following error:

'Data provider or other service returned an E_FAIL status'

Here is my Code

Code:
procedure TForm1.BitBtn3Click(Sender: TObject);
var
  t: integer;
begin
  Form1.ADOQuery4.SQL.Clear;
  Form1.ADOQuery4.SQL.Add('SELECT * FROM propertyhistory WHERE ID = '+form1.UNOID);
  Form1.ADOQuery4.Open;
  Form1.ADOQuery4.Edit;
  Form1.ADOQuery4['propHistory'] :=form1.rePropHistory.Lines.Text;
  Form1.ADOQuery4['whhpHistory'] :=form1.reWhhpHistory.Lines.Text;
  Form1.ADOQuery4['HistoryNotes']:=form1.reHistoryNotes.Lines.Text;
  Form1.ADOQuery4.Post;
end;
  #4  
Old 03-21-2013, 03:00 PM
Jasser Jasser is offline
Moderator
 
Join Date: Jan 2005
Location: Saudi Arabia
Posts: 5,060
Default

Where do you get the error? and what is the field type?
__________________
Regards,
Abdulaziz Jasser

Last edited by Jasser; 03-21-2013 at 03:40 PM.
Closed Thread

Tags
adoquery, database, msaccess, richedit

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 05:53 PM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.