-1

When I declare a variable like this :

Var Stream : TBlobStream;

I get an error :

undeclared identifier

So what is the problem? How can I solve this?

Ilyes
  • 14,640
  • 4
  • 29
  • 55
  • @DownVoter Can you tell me please why the downvote? at least leave a comment , is my question not clear or what? – Ilyes May 21 '17 at 12:24
  • In a comment on you earlier q today which you deleted, the reason Delphi cannot find DBTables.Pas is that it is one of the BDE units which is no longer installed by default, you have to do it manually. – MartynA May 21 '17 at 16:04
  • @MartynA But it seems unlikely that Sami is using BDE and so this is not going to be very useful I suspect. – David Heffernan May 22 '17 at 08:44
  • @DavidHeffernan: Maybe. I was only commenting on his compilation problem in the deleted q, which was about DBTables not being found. – MartynA May 22 '17 at 08:53
  • You both , I'm not using BDE , and stop downvote my posts for no reason – Ilyes May 22 '17 at 08:55
  • @MartynA The entire problem (this Q and the deleted Q) is a mistaken desire to declare a variable of type `TBlobStream`. Use `CreateBlobStream` and stop caring about the implementation details. – David Heffernan May 22 '17 at 09:00
  • @DavidHeffernan Can you tell me why you keep downvote all my questions? for no reason as I see – Ilyes May 22 '17 at 09:01
  • @Sami: I certainly didn't d-vote this or your earlier q. I was only commenting on this one in case you were still having the DBTables problem. – MartynA May 22 '17 at 09:03
  • 1
    @sami Voting is anonymous. You have no more idea than I do who casts votes. My advice is to stop worrying about voting. – David Heffernan May 22 '17 at 09:03
  • @DavidHeffernan Yes , I'm sure that the first time you see this post , you d-vote it , and for explanation , if somone ask a Q that mean he need help , and he don't know how to fix , he does not need a blam. – Ilyes May 22 '17 at 09:08

2 Answers2

2

You don't declare a variable of that type.

You call, for instance, CreateBlobStream on a dataset and then read or write with that stream.

Note that CreateBlobStream has return type of TStream. That's the abstract base class for all streams. The actual runtime type will be a concrete derived class, but don't need to know the actual runtime type to use this. In this way you are insulated from the implementation details.

So you would declare a local variable of type TStream and assign the value returned by CreateBlobStream to that variable. The Fish Facts example demonstrates this: http://docwiki.embarcadero.com/CodeExamples/en/FishFacts_(Delphi)

David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490
1

You can use the abstract TStream class here. That's just what the CreateBlobStream method returns.

Victoria
  • 7,822
  • 2
  • 21
  • 44