Class little dude...

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi to all...

I have a class with this properties:

private int id
private byte[] file

public int ID
{
get{return id;}
set{id=value;}
}
public byte[] File
{
get{return file;}
set{file=value;}
}

When i instance the object i can obtain the Id from database but i would
like to know how to fill (from binary field in Sql server) the property File,
and how to fill from the Property to Sql Server binary field in Sql database.


Thanks
Regards.
Josema
 
Hi Josema,

For filling the byte array you can use DataReader with CommandBehaviour set
to SequentialAccess and using the GetBytes method, read the contents of the
binary field in SQL Server and assign to the File property.

For more information look at this article which explains in detail how to go
about Read/Write BLOB fields in SQL Server.

<http://www.akadia.com/services/dotnet_read_write_blob.html>

HTH

Regards,
Madhu
MVP - C# | MCSD.NET
 
Back
Top