在VB.NET中使用NHibernate添加类型列长文本时,插入或更新失败

时间:2019-02-11 16:28:37

标签: vb.net ms-access fluent-nhibernate

我将Nhibernate 4和FluentNhibernate 2.0.3与db Microsoft Access 2000一起使用。我无法在数据库上保存该条目,因为在插入 Note 时出现错误>发送请求HTTP POST的字段,例如:

{     “注意”:“ bla bla bla” }

注意:在数据库表中,“注释”列设置为“长文本”(不是必需的)

可能是数据类型转换的问题吗?

这是堆栈跟踪:

NHibernate.Exceptions.GenericADOException: could not insert: [Domain.Destinatari#1773][SQL: INSERT INTO `Destinatari` (Note, IDDestinatario) VALUES (?, ?)] ---> System.Data.OleDb.OleDbException: Errore di sintassi nell'istruzione INSERT INTO.
   in System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(OleDbHResult hr)
   in System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult)
   in System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult)
   in System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult)
   in System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method)
   in System.Data.OleDb.OleDbCommand.ExecuteNonQuery()
   in NHibernate.JetDriver.JetDbCommand.ExecuteNonQuery()
   in NHibernate.AdoNet.AbstractBatcher.ExecuteNonQuery(IDbCommand cmd)
   in NHibernate.AdoNet.NonBatchingBatcher.AddToBatch(IExpectation expectation)
   in NHibernate.Persister.Entity.AbstractEntityPersister.Insert(Object id, Object[] fields, Boolean[] notNull, Int32 j, SqlCommandInfo sql, Object obj, ISessionImplementor session)
   --- Fine della traccia dello stack dell'eccezione interna ---
   in NHibernate.Persister.Entity.AbstractEntityPersister.Insert(Object id, Object[] fields, Boolean[] notNull, Int32 j, SqlCommandInfo sql, Object obj, ISessionImplementor session)
   in NHibernate.Persister.Entity.AbstractEntityPersister.Insert(Object id, Object[] fields, Object obj, ISessionImplementor session)
   in NHibernate.Action.EntityInsertAction.Execute()
   in NHibernate.Engine.ActionQueue.Execute(IExecutable executable)
   in NHibernate.Engine.ActionQueue.ExecuteActions(IList list)
   in NHibernate.Engine.ActionQueue.ExecuteActions()
   in NHibernate.Event.Default.AbstractFlushingEventListener.PerformExecutions(IEventSource session)

在我的映射代码下面:

Public Class DestinatariMap
        Inherits ClassMap(Of Destinatari)

        Public Sub New()
            MyBase.New
            LazyLoad()
            Id(Function(x) x.IDDestinatario).GeneratedBy().Increment()
            Map(Function(x) x.Note)
        End Sub
End Class

这是我的域代码:

Public Class Destinatari

        Private _ID_Destinatario As Integer
        Private _Note As String

        Public Overridable Property IDDestinatario() As Integer
            Get
                Return Me._ID_Destinatario
            End Get
            Set
                Me._ID_Destinatario = Value
            End Set
        End Property

        Public Overridable Property Note() As String
            Get
                Return Me._Note
            End Get
            Set
                Me._Note = Value
            End Set
        End Property
End Class

谢谢

0 个答案:

没有答案