Solved

TByteField

Posted on 1998-02-03
6
246 Views
Last Modified: 2010-05-18
How can i get the value of a TByteField in a dataset.

fieldtype in mssql = binary.

procedure TfrmFaxOut.tblxxxGetText(Sender: TField; var Text: String;
  DisplayText: Boolean);
begin
 x := Sender.Value;  // dont work !!!
end;

0
Comment
Question by:gipa
  • 3
  • 2
6 Comments
 

Author Comment

by:gipa
Comment Utility
Edited text of question
0
 
LVL 5

Expert Comment

by:JimBob091197
Comment Utility
For binary data, you can use a TBlobField.
If this is what you want, then you can look at:
http://www.experts-exchange.com/topics/bin/ShowQ?qid=8630035244

What type is "x" in "x := Sender.Value"?

JB
0
 
LVL 2

Expert Comment

by:Waldek
Comment Utility
What type is x
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 2

Accepted Solution

by:
Waldek earned 50 total points
Comment Utility
This may be a solution:
with field do
 begin
 if  not IsBlob then {Only for TByteFIeld}
   begin
    GetMem(Buffer,DataSize) //Must have a buffer with length datasize
 try
  if not GetData(Buffer) then // get a data from field
      messageDlg(' Field is NULL .........
    else
       // here Your work
   finally
     FreeMem(Buffer,DataSize);
 end;
end;
end;
0
 

Author Comment

by:gipa
Comment Utility
Waldek ,
How can i pass the value (it should be 0 or 1)

procedure TfrmFaxOut.tblFAXOEXTRGetText(Sender: TField; var Text: String;
  DisplayText: Boolean);
var
  buffer : PChar;
begin
  with sender do begin
    if not IsBlob then {Only for TBytesField}
    begin
      GetMem(Buffer, DataSize); //Must have a buffer with length datasize
      try
        if not GetData(Buffer) then // get a data from field
          showmessage('Field is null')
        else
          // here Your work
          Text := xxx  <----- How can i pass the value (it should be 0 or 1)
      finally
        FreeMem(Buffer,DataSize);
      end;
    end;
  end;
end;

0
 
LVL 2

Expert Comment

by:Waldek
Comment Utility
You may convert PChar to string and select Buffer[1] char
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This video discusses moving either the default database or any database to a new volume.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now