March 4, 2021
Hot Topics:

Working with Binary Large Objects (BLOBs) Using SQL Server and ADO.NET

  • By Bipin Joshi
  • Send Email »
  • More Articles »


Applications that deal with Binary Large Objects, or BLOBs, need to evaluate whether to store data inside SQL Server or as a physical file. SQL Server provides the varbinary(MAX) data type to store BLOBs although the older Image data type is still available. The BLOB data can be read in .NET applications by using the SqlDataReader class. The GetBytes() method of SqlDataReader allows you to read chunks of binary data from a column. When writing the binary data back to the database, the SQL server .WRITE clause can be used to write data in chunks. SQL server and ADO.NET together make it easy for you to deal with large binary data such as documents, files, and photos.

Download the Code

You can download the code that accompanies this article here.

About the Author

Bipin Joshi is the proprietor of BinaryIntellect Consulting where he conducts premier training programs on a variety of .NET technologies. He wears many hats, including a software consultant, mentor, prolific author, webmaster, Microsoft MVP, and a member of ASPInsiders. Having adopted the Yoga way of life, Bipin also teaches Kriya Yoga to interested individuals. He can be reached via his blog at www.bipinjoshi.com.

Page 7 of 7

This article was originally published on July 28, 2008

Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

Thanks for your registration, follow us on our social networks to keep up-to-date