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 ?
public byte[] ProductImage { get; set;}
会工作......图像只是二进制文件,你在SQL Server和你的应用程序之间编组它们作为byte []数据类型。
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 .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.