Question

I had a multi tier project in which i would collect data from a microsoft sql 2005 through a FDStoredProc with a function and the function would return a dataset to the client. When the server assigns the dataset to the result of the function and the function tries to send it to the client i get this error. Project etctec.exe raised exception class TDBXError with message 'TDBXTypes.BLOB value type cannot be accessed as TDBXTypes.Bytes value type'.

In another project i used the StoredProc of a different database with TFDStoredProc in exactly the same way and it works fine. Any ideas what would raise this error?

This is what i do in the server.

function TServerMethods1.getCategories(): TDataSet;
begin
  FDStoredProc1.ParamByName('@val1').AsInteger:= 1;
  FDStoredProc1.ParamByName('@val2').AsInteger:= 0;
  FDStoredProc1.ParamByName('@val3').AsInteger:= 1;
  FDStoredProc1.ParamByName('@val4').AsInteger:= 1;
  FDStoredProc1.Open();
  result:= FDStoredProc1;
end;

and the client calls it like this...

dataset:=ClientModule1.ServerMethods1Client.getCategories();

Problem comes from some fields that are of type NVARCHAR(max), anyone knows a workaround to this error without changing the field type?

I tried changing the dataset's field type to a string or something with no success. The only thing i can temporarily do is get these fields separately, put them in a stringlist or something like that and pass it to the client.

Was it helpful?

Solution

I think you should use some of similar methods below: http://docwiki.embarcadero.com/Libraries/XE4/en/Data.DB.TDataSet.CreateBlobStream http://docwiki.embarcadero.com/Libraries/XE4/en/Data.DB.TDataSet.GetBlobFieldData

You should define you field as a blob field and then put data in/out with the functions described in the links.

Here is also example how to copy data: http://docwiki.embarcadero.com/Libraries/XE4/en/Data.DB.TDataSet.CreateBlobStream

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top