将截断字符串或二进制数据。语句已终止……
我在设计数据库的时候准备在一个表中设计一个NContent字段,它的数据类型为varchar(50),由于是在可视模式下新建的,没有太注意,也许是鼠标滑轮不小心滑动力,导致NContent字段的数据变成了:nvarchar()类型了,所以在后来的添加数据时就出现了“将截断字符串或二进制数据。语句已终止……”的错误提示。。。
解决办法当然有多种,一是修改数据库字段大小; 二是加强数据强壮性,严格的输入判断。 目前是采用修改数据的方法:alter table1 alter column caller varchar(50)
以下为引用的内容: Server Error in '/Rainbow' Application. -------------------------------------------------------------------------------- 将截断字符串或二进制数据。语句已终止。 Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.SqlClient.SqlException: 将截断字符串或二进制数据。语句已终止。 Source Error: Line 488: myInputs.Add("InputParams" , InputParams); Line 489: myInputs.Add("RealModuleID" , ModuleID); Line 490: workflow.DoAction(wid, actionId, myInputs); Line 491: #region Line 492: #region Source File: C:InetpubwwwrootRainbowDesktopModulesTaokeCatalogsActionsDo.ascx.cs Line: 490 Stack Trace: [SqlException: 将截断字符串或二进制数据。 语句已终止。] System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream) +721 System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +196 NHibernate.Impl.NonBatchingBatcher.AddToBatch(Int32 expectedRowCount) +43 NHibernate.Persister.EntityPersister.Update(Object id, Object[] fields, Boolean[] includeProperty, Object oldVersion, Object obj, SqlString sqlUpdateString, ISessionImplementor session) +709 NHibernate.Persister.EntityPersister.Update(Object id, Object[] fields, Int32[] dirtyFields, Object[] oldFields, Object oldVersion, Object obj, ISessionImplementor session) +111 NHibernate.Impl.ScheduledUpdate.Execute() +134 NHibernate.Impl.SessionImpl.ExecuteAll(IList list) +128 NHibernate.Impl.SessionImpl.Execute() +103 [ADOException: could not synchronize database state with session] NHibernate.Impl.SessionImpl.Execute() +184 NHibernate.Impl.SessionImpl.Flush() +27 NHibernate.Transaction.AdoTransaction.Commit() +101 DotNetTools.Workflow.Spi.Hibernate.HibernateWorkflowStore.MarkFinished(IStep step, Int32 actionId, DateTime finishDate, String status, String caller) in D:WorkingWorkflowWorkflow-OldsrcDotNetTools.WorkflowSpiHibernateHibernateWorkflowStore.cs:309 [StoreException: Saving current step with action 102] DotNetTools.Workflow.AbstractWorkflow.DoAction(Int64 id, Int32 actionId, IDictionary inputs) in D:WorkingWorkflowWorkflow-OldsrcDotNetTools.WorkflowAbstractWorkflow.cs:721 Rainbow.DesktopModules.TaokeCatalogs.Actions.Do.DirectDoWorkflowAction(String sWid, Int32 actionId, User user) in C:InetpubwwwrootRainbowDesktopModulesTaokeCatalogsActionsDo.ascx.cs:490 Rainbow.DesktopModules.TaokeCatalogs.Actions.Do.Page_Load(Object sender, EventArgs e) in C:InetpubwwwrootRainbowDesktopModulesTaokeCatalogsActionsDo.ascx.cs:79 System.Web.UI.Control.OnLoad(EventArgs e) +67 Rainbow.UI.WebControls.PortalModuleControl.OnLoad(EventArgs e) in C:InetpubwwwrootRainbowapp_codeRainbowUIWebControlsPortalModuleControl.cs:710 System.Web.UI.Control.LoadRecursive() +35 System.Web.UI.Control.LoadRecursive() +98 System.Web.UI.Control.LoadRecursive() +98 System.Web.UI.Control.AddedControl(Control control, Int32 index) +307 System.Web.UI.ControlCollection.Add(Control child) +153 System.Web.UI.WebControls.RowControlCollection.Add(Control child) +33 DUEMETRI.UI.WebControls.DesktopPanes.CreateControlHierarchy() +1129 DUEMETRI.UI.WebControls.DesktopPanes.CreateChildControls() +27 Rainbow.UI.WebControls.DesktopPanes.CreateChildControls() in C:InetpubwwwrootRainbowapp_codeRainbowUIWebControlsDesktopPanes.cs:138 System.Web.UI.Control.EnsureChildControls() +100 System.Web.UI.Control.PreRenderRecursiveInternal() +38 System.Web.UI.Control.PreRenderRecursiveInternal() +125 System.Web.UI.Control.PreRenderRecursiveInternal() +125 System.Web.UI.Control.PreRenderRecursiveInternal() +125 System.Web.UI.Control.PreRenderRecursiveInternal() +125 System.Web.UI.Control.PreRenderRecursiveInternal() +125 System.Web.UI.Control.PreRenderRecursiveInternal() +125 System.Web.UI.Page.ProcessRequestMain() +1489 -------------------------------------------------------------------------------- Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573 |