Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access Violation in memo field

Status
Not open for further replies.

joemaur

Programmer
Feb 24, 2002
17
BR
Hi guys,

when I try to use the parambyname('fieldname').AsMemo,but I'm getting an access violation error. I'm setting the field with a TSringList type variable, and I tried to use the assign method and the same trouble happens.

Here's the code:
with spInsDoc do
begin
ParamByName('@cliente').AsString := info_doc.Cliente;
ParamByName('@usuario').AsString := info_doc.Usuario;
ParamByName('@senha').AsString := info_doc.Senha;
ParamByName('@Documento').AsString := info_doc.Documento;
ParamByName('@servico').AsString := info_doc.servico;
ParamByName('@titulo').AsString := info_doc.Titulo;
ParamByName('@formatacao').AsString := info_doc.formatacao;
ParamByName('@texto').AsMemo := tslDocumento.GetText; //here is where the error occurs
ExecProc;

Could anyone help me?
 
Are you sure that the access violation is in the .AsMemo, and not, perhaps, in the .GetText? Break the code up into two lines:
Code:
s := tslDocumento.GetText;
ParamByName('@texto').AsMemo := s;
GetText contains carraige returns and line feeds; does the problem occur when you assign simple text?
Code:
ParamByName('@texto').AsMemo := 'Hello';
Check the data type of the param, to see if it's really what you expect:
Code:
if ParamByName('@texto').DataType = ftMemo then ShowMessage('It''s really a memo!');
-- Doug Burbidge mailto:dougburbidge@yahoo.com
 
GetText method of TStringList is a virtual method which means that it's not implemented. If you need to get text from TstringList you can do like this : MyString := MyStringList.Text. But that text would contain all CR, LF sysmbols.

--- markus
 
GetText method of TStringList is a virtual method which means that it's not implemented. If you need to get text from TstringList you can do like this : MyString := MyStringList.Text. But that text would contain all CR, LF sysmbols.

--- markus
 
Sorry, my mistake. Virtual doesn't mean that it's not implemented.

-- markus
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top