ImageGear .NET v24.12 - Updated
Built-In SqlImageDataProvider
User Guide > How to Work with... > Common Operations > Viewing > Viewing Using ASP.NET > Web.config Settings for HTML5 Viewer and Legacy ASP.NET Controls > Description of Configuration Settings > Image Data Provider Configuration > Built-In SqlImageDataProvider

Any database may be specified for the SqlImageDataProvider, provided there is an ADO.NET data provider for that database.

The image data can be stored in the database as blobs or in files. When the image data is stored in the database as "Blobs", the column data type is expected to be of binary type. For example, in SQL 2005, use "image" data type or use varbinary(max) data type. It is recommended to use the varbinary(max) data type since the "image" data type has been deprecated in SQL 2008. This built-in SqlImageDataProvider also supports the newly introduced FILESTREAM feature in SQL Server 2008.

When storing image data in files, create a column in your database that contains the file name, with Sql data type as Text.

Regardless of the Image storage methods, the annotations data are always stored as  "CLOB" (Character Large Object). The Sql data type is Varchar(MAX) in the Sql Server.

Web.config
Copy Code
<configuration>
 <configSections>
.....
.....
<section name="ImageGear.Web.DataProviders.ImageProvider" type="ImageGear.Web.DataProviders.ImageDataProviderConfiguration,ImageGear24.Web.Services" />
....
....
</configSections>
.....
......
<ImageGear.Web.DataProviders.ImageProvider default="SqlImageDataProvider">
<providers>
   <add name="SqlImageDataProvider" type="ImageGear.Web.DataProviders.SqlImageDataProvider,ImageGear24.Web.Services" connectionStringName="SqlImageProviderConnection"
sqlCommand="SELECT ImageData FROM dbo.ImageStore WHERE [Image_key] = @Image_key"
sqlCommandType="Text"
sqlImageDataField="ImageData"
sqlParameter="@Image_key"
paramKeySqlDbType="UniqueIdentifier"
paramKeyLength="36"
cachingEnable="false"
sqlCacheDependencyNeeded="false"
initSqlCacheDependency="false"
maxImageSizeToCache="512"
cachingTimeLimit="5"
sqlArtReadCommand="SELECT ArtDocument FROM dbo.ImageStore WHERE [Image_key] = @Image_key"
sqlArtReadCommandType="Text"
sqlArtUpdateCommand="UPDATE dbo.ImageStore SET ArtDocument = @myArtData WHERE [Image_key] = @Image_key"
sqlArtUpdateCommandType="Text"
sqlArtDataField="ArtDocument"/>
</providers>
</ImageGear.Web.DataProviders.ImageProvider>
....
</configuration>

This section provides information about the following: