[英]image data type SQL Server 2008 C# data type
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# 我正在尝试用C#编写ProductImages类
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 ? 我如何为ProductImage声明属性?
public byte[] ProductImage { get; set;}
会工作......图像只是二进制文件,你在SQL Server和你的应用程序之间编组它们作为byte []数据类型。
Use a byte[]
in c# and I suggest changing your column type to VARBINARY(MAX)
. 在c#中使用
byte[]
,我建议将列类型更改为VARBINARY(MAX)
。 Support for the image data type will be removed in the future . 将来将删除对图像数据类型的支持。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.