Board index » delphi » Retreive values from text columns (sql server 2000)

Retreive values from text columns (sql server 2000)

How can I retreive the value of a column of type "text"?

I tried this way:

var
    stream:TStream;
    sp_GetText:TADOStroredProc;
    ...
begin
...
    with sp_GetText do begin
      ProcudereName:='usp_getText';
      Parameters.Refresh;
      Parameters[1].Value:=ActiveDid;
      Parameters[2].Value:=BDName;
      try
        Open;
        stream:=CreateBlobStream(FieldByName('testo'),bmRead);
...

where usp_getText is something like this:
    select testo from testi where ...

The problem is that sometimes SQL Server crashes with error 5180 (looking
for it in MSDN, it seems to be a problem concerning reading and writing text
columns).

Is there another way to retrieve such values?

Thanks
Ruggero

 

Re:Retreive values from text columns (sql server 2000)


How can I retreive the value of a column of type "text"?

I tried this way:

var
    stream:TStream;
    sp_GetText:TADOStroredProc;
    ...
begin
...
    with sp_GetText do begin
      ProcudereName:='usp_getText';
      Parameters.Refresh;
      Parameters[1].Value:=ActiveDid;
      Parameters[2].Value:=BDName;
      try
        Open;
        stream:=CreateBlobStream(FieldByName('testo'),bmRead);
...

where usp_getText is something like this:
    select testo from testi where ...

The problem is that sometimes SQL Server crashes with error 5180 (looking
for it in MSDN, it seems to be a problem concerning reading and writing text
columns).

Is there another way to retrieve such values?

Thanks
Ruggero

Re:Retreive values from text columns (sql server 2000)


Quote
"Ruggero Rossi" <ruggero.maria.ro...@libero.it> wrote in message

news:3d9031aa@newsgroups.borland.com...

Quote
> How can I retreive the value of a column of type "text"?

Your TADOStoredProc component should have a TMemoField available
automatically. Just access the AsString value. e.g.

sp_GetText.FieldByName('testo').AsString

I assume you are using the OLE DB provider for SQL Server in your connection
string.
Error 5180 appears related to reading text data when using a READ UNCOMMITED
isolation level . It's better to only read committed data (the default).
Make sure you have the latest SQL Server service pack as well, as this issue
has been addressed.

Regards,
Andy Mackie.

Other Threads