Board index » delphi » Text data type MSSQL

Text data type MSSQL

Hello all,
can Text data type in MSSQL, be displayed on a dbgrid? If no, any ideas how
to?

Thanks

*****************************************************
George Christoforakis

 

Re:Text data type MSSQL


"George Christoforakis" <George.Christofora...@RatioGroup.com> wrote

Quote
> Can Text data type in MSSQL, be displayed on a dbgrid?
> If no, any ideas how to?

George, Do you mean BLOB text type?
For that I usually use a TDBMemo and only show current record.
Regards, JohnH

Re:Text data type MSSQL


ah ok. I did that for each record individually but I guess that the grid
can't show the data eh?

thanx :-)

George Christoforakis

"John Herbster (TeamB)" <herb-sci1_at_sbcglobal.net> wrote in message
news:3efc4674$1@newsgroups.borland.com...

Quote

> "George Christoforakis" <George.Christofora...@RatioGroup.com> wrote
> > Can Text data type in MSSQL, be displayed on a dbgrid?
> > If no, any ideas how to?

> George, Do you mean BLOB text type?
> For that I usually use a TDBMemo and only show current record.
> Regards, JohnH

Re:Text data type MSSQL


"George Christoforakis" <George.Christofora...@RatioGroup.com> wrote in
message news:3efc4907@newsgroups.borland.com...

Quote
> ah ok. I did that for each record individually but I guess that the grid
> can't show the data eh?

Owner draw is what to do
If on the grid
Your memo to shoe

(Yes......I know - but show don't rhyme).

Quote

> thanx :-)

> George Christoforakis

> "John Herbster (TeamB)" <herb-sci1_at_sbcglobal.net> wrote in message
> news:3efc4674$1@newsgroups.borland.com...

> > "George Christoforakis" <George.Christofora...@RatioGroup.com> wrote
> > > Can Text data type in MSSQL, be displayed on a dbgrid?
> > > If no, any ideas how to?

> > George, Do you mean BLOB text type?
> > For that I usually use a TDBMemo and only show current record.
> > Regards, JohnH

Re:Text data type MSSQL


Quote
George Christoforakis wrote:
> ah ok. I did that for each record individually but I guess that the
> grid can't show the data eh?

        It's possible -- you can make a calculated string field, for example,
and assign the Blob text to the calculated field in the OnCalcFields
event.  But you'll only get the first n characters, whatever the size
of the calculated field is.  Shouldn't be a problem for a grid, though.

        Keep in mind, however, that Blob data is often stored separately from
the rest of the record (I don't know how SQL Server handles this
internally, but if your Blobs are going to be at all large it's the
only intelligent way to do it), so fetching Blob data for lots of
records can be a bit slow compared to the rest of the columns in the
table.

        -Craig

Re:Text data type MSSQL


"George Christoforakis" <George.Christofora...@RatioGroup.com> wrote

Quote
> ah ok. I did that for each record individually
> but I guess that the grid can't show the data eh?

George, If you really want to put it into a DBGrid, I am sure
that it can be done.  Either by some of the 3rd-party DB grid
components or just by making a calculated field that moves
the BLOB text to regular text.  Regards, JohnH

Re:Text data type MSSQL


It's even better if you use the OnGetText event of the field...

something like this:

procedure TForm1.YourFieldGetText(Sender: TField; var Text: String;
DisplayText: Boolean);
begin
  if not Sender.IsNull then
    Text:=Sender.AsString;
end;

This way you don't have to create any Calc Fields and the AsString property
retrieves all the data, and you may use the same procedure for several memo
fields.

If you use persistent fields you can assign it in design, else declare one
and assing it in run time.

Regards

"Craig Stuntz [TeamB]" <cstu...@vertexsoftware.com> escribi en el mensaje
news:3efc50f3@newsgroups.borland.com...

Quote
> George Christoforakis wrote:

> > ah ok. I did that for each record individually but I guess that the
> > grid can't show the data eh?

> It's possible -- you can make a calculated string field, for example,
> and assign the Blob text to the calculated field in the OnCalcFields
> event.  But you'll only get the first n characters, whatever the size
> of the calculated field is.  Shouldn't be a problem for a grid, though.

> Keep in mind, however, that Blob data is often stored separately from
> the rest of the record (I don't know how SQL Server handles this
> internally, but if your Blobs are going to be at all large it's the
> only intelligent way to do it), so fetching Blob data for lots of
> records can be a bit slow compared to the rest of the columns in the
> table.

> -Craig

Re:Text data type MSSQL


Quote
Christoforakis <George.Christofora...@RatioGroup.com> wrote in message

news:3efc459f$1@newsgroups.borland.com...
Quote
> Hello all,
> can Text data type in MSSQL, be displayed on a dbgrid? If no, any ideas
how
> to?

> Thanks

> *****************************************************
> George Christoforakis

Hi,

Can you use a dbctrlgrid, with a tmemo 1 or 2 lines long?

David

Other Threads