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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

DataColumn array issue 2
8-byte value as primary key? 1
Yet another issue with DataColumn inhertiance 6
Binary Data as Primary Key? 2
AllowDBNull property 1
datacolumn 1
datacolumn replace 3
datatable.importrow bug 1

Back
Top