使用 session.Delete 获取错误:“无法执行查询”。
当我复制查询并在 SQL Server Management Studio 中运行它时,选择查询运行没有问题。似乎问题出在删除或其他东西上……我使用相同的方法从其他表中删除了记录,并且似乎工作正常。
任何想法是什么原因造成的?
班上:
public class MultisitePublicBooking
{
public virtual int Id { get; set; }
public virtual int multisiteID { get; set; }
public virtual DateTime startDate { get; set; }
public virtual DateTime startTime { get; set; }
}
public MultisitePublicBookingMap()
{
Table("tblMultisitePublicBooking");
Id(x => x.Id).Column("PublicBookingID");
Map(x => x.multisiteID).Column("MultisiteID");
Map(x => x.startDate).Column("StartDate");
Map(x => x.startTime).Column("StartTime");
}
表如下:
CREATE TABLE [dbo].[tblMultisitePublicBooking](
[PublicBookingID] [int] IDENTITY(1,1) NOT NULL,
[MultisiteID] [int] NULL,
[NumAttendees] [int] NULL,
[AttendeeName] [varchar](1024) NULL,
[AttendeePhone] [varchar](128) NULL,
[AtendeeEmail] [varchar](500) NULL,
[BookingPrice] [money] NULL,
[LID] [int] NULL,
[TimeZoneID] [int] NULL,
[DateTimeModified] [datetime] NULL,
[DateTimeCreated] AS (getdate()),
[CurrentStep] [nvarchar](50) NULL,
[CallType] [nvarchar](8) NULL,
[CallSpeed] [nvarchar](10) NULL,
[StartDate] [date] NULL,
[StartTime] [time](7) NULL,
[endtime] [time](7) NULL,
[Duration] [time](7) NULL,
[Catering] [nvarchar](200) NULL,
[Equipment] [nvarchar](200) NULL,
[Telepresence] [bit] NULL,
[telepresenceConfigOption] [nvarchar](50) NULL,
[Sync] [bit] NULL,
[ReceiveOrDial] [varchar](50) NULL,
[NoteTXT] [text] NULL,
CONSTRAINT [PK_tblMultisitePublicBooking] PRIMARY KEY CLUSTERED
(
[PublicBookingID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
完整的错误信息是:无法执行查询
[ select multisitep0_.PublicBookingID as PublicBo1_18_, multisitep0_.MultisiteID as Multisit2_18_, multisitep0_.NumAttendees as NumAtten3_18_, multisitep0_.AttendeeName as Attendee4_18_, multisitep0_.AttendeePhone as Attendee5_18_, multisitep0_.AtendeeEmail as AtendeeE6_18_, multisitep0_.BookingPrice as BookingP7_18_, multisitep0_.LID as LID18_, multisitep0_.DateTimeModified as DateTime9_18_, multisitep0_.CurrentStep as Current10_18_, multisitep0_.CallType as CallType18_, multisitep0_.CallSpeed as CallSpeed18_, multisitep0_.StartDate as StartDate18_, multisitep0_.StartTime as StartTime18_, multisitep0_. Catering as Catering18_, multisitep0_psite_Equipment. Equipment. Telepresence 作为 Telepre17_18_,multisitep0_.telepresenceConfigOption 作为 telepre18_18_,multisitep0_.Sync 作为 Sync18_,multisitep0_.ReceiveOrDial 作为 Receive20_18_,multisitep0_.NoteTXT as NoteTXT18_ from tblMultisitePublicBooking multisitep0_ where multisitep0_.MultisiteID=101156 ] [SQL: select multisitep0_.PublicBookingID as PublicBo1_18_, multisitep0_.MultisiteID as Multisit2_18_, multisitep0_.NumAttendees as NumAtten3_18_, multisitep0_.AttendeeName as Attendee4_18_, multisitep0_.AttendeePhone as Attendee5_18_, multisitep0_ .AtendeeEmail 作为 AtendeeE6_18_,multisitep0_.BookingPrice 作为 BookingP7_18_,multisitep0_.LID 作为 LID18_,multisitep0_.DateTimeModified 作为 DateTime9_18_,multisitep0_.CurrentStep 作为 Current10_18_,multisitep0_.CallType 作为 CallType18_,multisitep0_.CallSpeed 作为 Call_Speed18_,multisitep0 Start_.StartD作为 StartTime18_,multisitep0_.Catering 作为 Catering18_,multisitep0_.Equipment 作为 Equipment18_,multisitep0_.Telepresence 作为 Telepre17_18_,multisitep0_。telepresenceConfigOption 作为 telepre18_18_, multisitep0_.Sync 作为 Sync18_, multisitep0_.ReceiveOrDial 作为 Receive20_18_, multisitep0_.NoteTXT 作为 NoteTXT18_ 来自 tblMultisitePublicBooking multisitep0_ where multisitep0_.MultisiteID=101156]
内部异常是:
{"Input string '20:00:00' was not in the correct format."}
{"Unable to cast object of type 'System.TimeSpan' to type 'System.IConvertible'."}