Database Reference
In-Depth Information
Figure 17-4.
The Design view of the DisplayImages form
8.
Add a new class named
Images
to this Windows Form project. To add this,
select the Text and Binary Data project, right-click, select Class… in the Add
New Item dialog, name the class
Images.cs
, and click Add to have it listed
under your project. Once it's added, replace the code in
Images.cs
with the
code in Listing 17-2.
Listing 17-2.
I
mages.cs
using System.Data.SqlClient;
using System.IO;
using System.Drawing;
namespace Text_and_Binary_Data
{
public class Images
{
string imageFilename = null;
byte[] imageBytes = null;
SqlConnection imageConnection = null;
SqlCommand imageCommand = null;
SqlDataReader imageReader = null;
// Constructor
public Images()
{