问题描述
直接是用的session.save()来添加一个实体啊。别的对象可以添加这个就报语法错误不知道怎么回事啊有大神吗?2015-03-2219:01:15,730[9]DEBUGNHibernate.AdoNet.AbstractBatcher-BuildinganIDbCommandobjectfortheSqlString:INSERTINTOKe_UserInfo(Email,Image,Infomation,Phone,Pwd,Remark,Status,UName,RealName,OrgName,Address,Fax,RegisterTime,LastLoginTime,LoginCount)VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)2015-03-2219:01:15,731[9]DEBUGNHibernate.Persister.Entity.AbstractEntityPersister-Dehydratingentity:[LZQ.KeXie.Model.UserInfo#<null>]2015-03-2219:01:15,731[9]DEBUGNHibernate.Type.StringType-binding'email'toparameter:02015-03-2219:01:15,731[9]DEBUGNHibernate.Type.StringType-binding'image'toparameter:12015-03-2219:01:15,731[9]DEBUGNHibernate.Type.StringType-binding'information'toparameter:22015-03-2219:01:15,731[9]DEBUGNHibernate.Type.StringType-binding'13333333333'toparameter:32015-03-2219:01:15,732[9]DEBUGNHibernate.Type.StringType-binding'pwd'toparameter:42015-03-2219:01:15,732[9]DEBUGNHibernate.Type.StringType-binding'remark'toparameter:52015-03-2219:01:15,732[9]DEBUGNHibernate.Type.Int32Type-binding'1'toparameter:62015-03-2219:01:15,732[9]DEBUGNHibernate.Type.StringType-binding'uname'toparameter:72015-03-2219:01:15,732[9]DEBUGNHibernate.Type.StringType-binding'RealName'toparameter:82015-03-2219:01:15,732[9]DEBUGNHibernate.Type.StringType-binding'OrgName'toparameter:92015-03-2219:01:15,732[9]DEBUGNHibernate.Type.StringType-binding'地址'toparameter:102015-03-2219:01:15,732[9]DEBUGNHibernate.Type.StringType-binding'fax'toparameter:112015-03-2219:01:15,732[9]DEBUGNHibernate.Type.DateTimeType-binding'2015/3/2219:01:14'toparameter:122015-03-2219:01:15,732[9]DEBUGNHibernate.Type.DateTimeType-binding'2015/3/2219:01:14'toparameter:132015-03-2219:01:15,732[9]DEBUGNHibernate.Type.Int32Type-binding'0'toparameter:142015-03-2219:01:15,736[9]DEBUGNHibernate.SQL-INSERTINTOKe_UserInfo(Email,Image,Infomation,Phone,Pwd,Remark,Status,UName,RealName,OrgName,Address,Fax,RegisterTime,LastLoginTime,LoginCount)VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?);p0='email'[Type:String(5)],p1='image'[Type:String(5)],p2='information'[Type:String(11)],p3='13333333333'[Type:String(11)],p4='pwd'[Type:String(3)],p5='remark'[Type:String(6)],p6=1[Type:Int32(0)],p7='uname'[Type:String(5)],p8='RealName'[Type:String(8)],p9='OrgName'[Type:String(7)],p10='地址'[Type:String(2)],p11='fax'[Type:String(3)],p12=2015/3/2219:01:14[Type:DateTime(0)],p13=2015/3/2219:01:14[Type:DateTime(0)],p14=0[Type:Int32(0)]2015-03-2219:01:15,737[9]DEBUGNHibernate.Transaction.AdoTransaction-EnlistCommand2015-03-2219:01:15,782[9]ERRORNHibernate.AdoNet.AbstractBatcher-Couldnotexecutecommand:INSERTINTOKe_UserInfo(Email,Image,Infomation,Phone,Pwd,Remark,Status,UName,RealName,OrgName,Address,Fax,RegisterTime,LastLoginTime,LoginCount)VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)System.Data.OleDb.OleDbException(0x80040E14):INSERTINTO语句的语法错误。在System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(OleDbHResulthr)在System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMSdbParams,Object&executeResult)在System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object&executeResult)在System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehaviorbehavior,Object&executeResult)在System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehaviorbehavior,Stringmethod)在System.Data.OleDb.OleDbCommand.ExecuteNonQuery()在NHibernate.AdoNet.AbstractBatcher.ExecuteNonQuery(IDbCommandcmd)2015-03-2219:01:15,799[9]DEBUGNHibernate.AdoNet.AbstractBatcher-ExecuteNonQuerytook62ms2015-03-2219:01:15,801[9]DEBUGNHibernate.AdoNet.AbstractBatcher-ClosedIDbCommand,openIDbCommands:02015-03-2219:01:15,804[9]DEBUGNHibernate.Util.ADOExceptionReporter-couldnotinsert:[LZQ.KeXie.Model.UserInfo][INSERTINTOKe_UserInfo(Email,Image,Infomation,Phone,Pwd,Remark,Status,UName,RealName,OrgName,Address,Fax,RegisterTime,LastLoginTime,LoginCount)VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)]System.Data.OleDb.OleDbException(0x80040E14):INSERTINTO语句的语法错误。在System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(OleDbHResulthr)在System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMSdbParams,Object&executeResult)在System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object&executeResult)在System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehaviorbehavior,Object&executeResult)在System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehaviorbehavior,Stringmethod)在System.Data.OleDb.OleDbCommand.ExecuteNonQuery()在NHibernate.AdoNet.AbstractBatcher.ExecuteNonQuery(IDbCommandcmd)在NHibernate.Id.Insert.AbstractSelectingDelegate.PerformInsert(SqlCommandInfoinsertSQL,ISessionImplementorsession,IBinderbinder)2015-03-2219:01:15,804[9]WARNNHibernate.Util.ADOExceptionReporter-System.Data.OleDb.OleDbException(0x80040E14):INSERTINTO语句的语法错误。在System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(OleDbHResulthr)在System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMSdbParams,Object&executeResult)在System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object&executeResult)在System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehaviorbehavior,Object&executeResult)在System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehaviorbehavior,Stringmethod)在System.Data.OleDb.OleDbCommand.ExecuteNonQuery()在NHibernate.AdoNet.AbstractBatcher.ExecuteNonQuery(IDbCommandcmd)在NHibernate.Id.Insert.AbstractSelectingDelegate.PerformInsert(SqlCommandInfoinsertSQL,ISessionImplementorsession,IBinderbinder)2015-03-2219:01:15,804[9]ERRORNHibernate.Util.ADOExceptionReporter-INSERTINTO语句的语法错误。
解决方案
本帖最后由 u010233077 于 2015-03-22 19:24:15 编辑
解决方案二:
<?xmlversion="1.0"encoding="utf-8"?><hibernate-mappingxmlns="urn:nhibernate-mapping-2.2"default-lazy="true"><classname="LZQ.KeXie.Model.UserInfo,LZQ.KeXie.Model"table="Ke_UserInfo"><idname="ID"column="ID"type="Int32"length="4"unsaved-value="0"><generatorclass="native"/></id><propertyname="Email"column="Email"type="String"length="128"/><propertyname="Image"column="Image"type="String"length="510"/><propertyname="Infomation"column="Infomation"type="String"length="510"/><propertyname="Phone"column="Phone"type="String"length="128"/><propertyname="Pwd"column="Pwd"type="String"length="256"/><propertyname="Remark"column="Remark"type="String"length="510"/><propertyname="Status"column="Status"type="Int32"length="4"/><propertyname="UName"column="UName"type="String"length="64"/><propertyname="RealName"column="RealName"type="String"length="256"/><propertyname="OrgName"column="OrgName"type="String"length="256"/><propertyname="Address"column="Address"type="String"length="256"/><propertyname="Fax"column="Fax"type="String"length="128"/><propertyname="RegisterTime"column="RegisterTime"type="DateTime"/><propertyname="LastLoginTime"column="LastLoginTime"type="DateTime"/><propertyname="LoginCount"column="LoginCount"type="Int32"length="4"/></class></hibernate-mapping>这是配置文件也没问题啊