Reputation: 575
I created a data table
CREATE TABLE [ProductImages]
(
[ProductImageID] [int] IDENTITY(1,1) NOT NULL,
[ProductImage] [image] NOT NULL
CONSTRAINT [PK_ProductImages] PRIMARY KEY CLUSTERED
(
[ProductImageID] ASC
)
)
I'm trying to write ProductImages class in C#
public class ProductImages
{
private int productImageID;
public int ProductImageID
{
get { return productImageID; }
set { productImageID = value; }
}
// I need to declare property for ProductImage???
}
How do i declare property for ProductImage ?
Upvotes: 6
Views: 40641
Reputation: 54417
Use a byte[]
in c# and I suggest changing your column type to VARBINARY(MAX)
. Support for the image data type will be removed in the future.
Upvotes: 12
Reputation: 88092
public byte[] ProductImage { get; set;}
Would work... Images are just binary files and you marshal them between SQL Server and your application as the byte[] data type.
Upvotes: 24