我花了很多时间尝试解决方案无济于事,所以请帮忙。 我在数据库上有一个表格:
CREATE TABLE [dbo].[FlowsortJobDetails](
[JobID] [int] IDENTITY(1,1) NOT NULL,
[SortID] [varchar](11) NOT NULL,
[SortType] [varchar](16) NOT NULL,
[SortStatus] [varchar](8) NOT NULL,
[JobName] [varchar](16) NULL,
[Year] [varchar](4) NULL,
[Sight] [varchar](2) NULL,
[Lot] [varchar](16) NULL,
[JobSize] [varchar](16) NULL,
[JobWeight] [float] NULL,
[SaveAllImages] [bit] NULL,
[SortmapFilename] [varchar](32) NULL,
[BinAllocationFilename] [varchar](32) NULL,
[SplitFilename] [varchar](32) NULL,
[AllToBinNumber] [int] NULL,
[NumberOfWays] [int] NULL,
[CreatedBy] [varchar](16) NULL,
[CreatedDate] [datetime2](7) NULL,
[StartedDate] [datetime2](7) NULL,
[MachineID] [varchar](8) NULL
) ON [PRIMARY]
我有一个实体界面:
public DbSet FlowsortJobDetails {get;组; }
和数据定义为:
[Table("FlowsortJobDetails")]
public class Job
{
public System.Int32 JobID { get; set; }
[StringLength(11)]
public System.String SortID { get; set; }
[StringLength(16)]
public System.String SortType { get; set; }
[StringLength(8)]
public System.String SortStatus { get; set; }
[StringLength(16)]
public System.String JobName { get; set; }
[StringLength(4)]
public System.String Year { get; set; }
[StringLength(2)]
public System.String Sight { get; set; }
[StringLength(16)]
public System.String Lot { get; set; }
[StringLength(16)]
public System.String JobSize { get; set; }
public System.Double JobWeight { get; set; }
public System.Boolean SaveAllImages { get; set; }
[StringLength(32)]
public System.String SortmapFilename { get; set; }
[StringLength(32)]
public System.String BinAllocationFilename { get; set; }
[StringLength(32)]
public System.String SplitFilename { get; set; }
public System.Int32 AllToBinNumber { get; set; }
public System.Int32 NumberOfWays { get; set; }
[StringLength(16)]
public System.String CreatedBy { get; set; }
public System.DateTime CreatedDate { get; set; }
public System.DateTime StartedDate { get; set; }
[StringLength(8)]
public System.String MachineID { get; set; }
}
我可以使用SqlDataAdapter从数据库中读取此表以确认数据名称和定义。我想使用实体框架来读取和更新此表,但我得到的只是一个异常告诉我"无效的列名..."从JobName开始。