Store Byte Array as DataColumn?

  • Thread starter Thread starter localhost
  • Start date Start date
L

localhost

Is it possible to store a byte[] array as a type for a DataColumn? I
was thinking of a generic way to store *anything* in a DataColumn
without seriously typing it, then I can pass the DataSet that contains
it anywhere.

If that is not possible, can I just use an object as a DataColumn
type?

Thanks.
 
Hi,
Is it possible to store a byte[] array as a type for a DataColumn? I
was thinking of a generic way to store *anything* in a DataColumn
without seriously typing it, then I can pass the DataSet that contains
it anywhere.

I see no problem, so you would have to explain something more.
(It is somethimes called a blob field).
You have of course to define it using the fill. "select" or with gettype.

Cor
 
Yes, you can. Even more, you can define such a column in XSD and then build
a strongly-typed dataset, which respects your custom type. For example,
that's how the XSD designer makes Guid columns:

<xs:element name="StereotypeID" type="xs:string" minOccurs="0"
msdata:DataType="System.Guid, mscorlib, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089" />

You can specify either System.Object or even your own class as a datatype
for a column. Don't forget to place it into GAC< btw.



Hope, that helps,

Gleb.
 
Back
Top