<急问>vs 2005 的控件绑定sql 2000时候会出现问题么? 我使用detailview来实现很简单的data display,显示的时候没有问题,然后什么都不改直接edit,update就会报错ms是数据库的问题,但我根本没法看到内部的sql代码不知道是怎么回事呢? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 补充一下,换用其他控件也有类似的问题出现。比如formview,gridview。我觉得应该是数据库的问题,但是不知道从何入手可以解决。比较急,大家帮忙看看吧。 错误信息如下:Server Error in '/GP_Pro' Application.--------------------------------------------------------------------------------Line 1: Incorrect syntax near 'nvarchar'. 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: Line 1: Incorrect syntax near 'nvarchar'.Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [SqlException (0x80131904): Line 1: Incorrect syntax near 'nvarchar'.] System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +95 System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +82 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +346 System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +3244 System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +186 System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +1121 System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +334 System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) +407 System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +149 System.Web.UI.WebControls.SqlDataSourceView.ExecuteDbCommand(DbCommand command, DataSourceOperation operation) +493 System.Web.UI.WebControls.SqlDataSourceView.ExecuteUpdate(IDictionary keys, IDictionary values, IDictionary oldValues) +915 System.Web.UI.DataSourceView.Update(IDictionary keys, IDictionary values, IDictionary oldValues, DataSourceViewOperationCallback callback) +179 System.Web.UI.WebControls.GridView.HandleUpdate(GridViewRow row, Int32 rowIndex, Boolean causesValidation) +1140 System.Web.UI.WebControls.GridView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup) +835 System.Web.UI.WebControls.GridView.OnBubbleEvent(Object source, EventArgs e) +162 System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +56 System.Web.UI.WebControls.GridViewRow.OnBubbleEvent(Object source, EventArgs e) +118 System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +56 System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +107 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +175 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +31 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +32 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +72 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3839 --------------------------------------------------------------------------------Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42 多谢!!! 我直接拖控件的,能找到的只是自动生成的代码<asp:Content ID="Content1" runat="server" ContentPlaceHolderID="ContentPlaceHolder1"> <asp:Label ID="Label1" runat="server" BackColor="LightPink" Font-Bold="True" Font-Underline="False" ForeColor="SteelBlue" Text="Operation:Configuration:Budget Control Method" Width="378px"></asp:Label><br /> <asp:DetailsView ID="DetailsView2" runat="server" AutoGenerateRows="False" DataKeyNames="site" DataSourceID="SqlDataSource1" Height="50px" Width="125px"> <Fields> <asp:BoundField DataField="site" HeaderText="site" ReadOnly="True" SortExpression="site" /> <asp:BoundField DataField="forcase_ww" HeaderText="forcase_ww" SortExpression="forcase_ww" /> <asp:BoundField DataField="Budget_control" HeaderText="Budget_control" SortExpression="Budget_control" /> <asp:BoundField DataField="Approve_method" HeaderText="Approve_method" SortExpression="Approve_method" /> <asp:BoundField DataField="Coordinator" HeaderText="Coordinator" SortExpression="Coordinator" /> <asp:BoundField DataField="cut-off_day" HeaderText="cut-off_day" SortExpression="cut-off_day" /> <asp:BoundField DataField="cut-off_time" HeaderText="cut-off_time" SortExpression="cut-off_time" /> <asp:CommandField ShowEditButton="True" ButtonType="Button" /> </Fields> </asp:DetailsView> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConflictDetection="CompareAllValues" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" DeleteCommand="DELETE FROM [site_depend_configuration] WHERE [site] = @original_site AND [forcase_ww] = @original_forcase_ww AND [Budget_control] = @original_Budget_control AND [Approve_method] = @original_Approve_method AND [Coordinator] = @original_Coordinator AND [cut-off_day] = @original_column1 AND [cut-off_time] = @original_column2" InsertCommand="INSERT INTO [site_depend_configuration] ([site], [forcase_ww], [Budget_control], [Approve_method], [Coordinator], [cut-off_day], [cut-off_time]) VALUES (@site, @forcase_ww, @Budget_control, @Approve_method, @Coordinator, @column1, @column2)" OldValuesParameterFormatString="original_{0}" SelectCommand="SELECT * FROM [site_depend_configuration]" UpdateCommand="UPDATE [site_depend_configuration] SET [forcase_ww] = @forcase_ww, [Budget_control] = @Budget_control, [Approve_method] = @Approve_method, [Coordinator] = @Coordinator, [cut-off_day] = @column1, [cut-off_time] = @column2 WHERE [site] = @original_site AND [forcase_ww] = @original_forcase_ww AND [Budget_control] = @original_Budget_control AND [Approve_method] = @original_Approve_method AND [Coordinator] = @original_Coordinator AND [cut-off_day] = @original_column1 AND [cut-off_time] = @original_column2" ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>"> <DeleteParameters> <asp:Parameter Name="original_site" Type="String" /> <asp:Parameter Name="original_forcase_ww" Type="Int32" /> <asp:Parameter Name="original_Budget_control" Type="String" /> <asp:Parameter Name="original_Approve_method" Type="String" /> <asp:Parameter Name="original_Coordinator" Type="String" /> <asp:Parameter Name="original_column1" Type="String" /> <asp:Parameter Name="original_column2" Type="String" /> </DeleteParameters> <UpdateParameters> <asp:Parameter Name="forcase_ww" Type="Int32" /> <asp:Parameter Name="Budget_control" Type="String" /> <asp:Parameter Name="Approve_method" Type="String" /> <asp:Parameter Name="Coordinator" Type="String" /> <asp:Parameter Name="column1" Type="String" /> <asp:Parameter Name="column2" Type="String" /> <asp:Parameter Name="original_site" Type="String" /> <asp:Parameter Name="original_forcase_ww" Type="Int32" /> <asp:Parameter Name="original_Budget_control" Type="String" /> <asp:Parameter Name="original_Approve_method" Type="String" /> <asp:Parameter Name="original_Coordinator" Type="String" /> <asp:Parameter Name="original_column1" Type="String" /> <asp:Parameter Name="original_column2" Type="String" /> </UpdateParameters> <InsertParameters> <asp:Parameter Name="site" Type="String" /> <asp:Parameter Name="forcase_ww" Type="Int32" /> <asp:Parameter Name="Budget_control" Type="String" /> <asp:Parameter Name="Approve_method" Type="String" /> <asp:Parameter Name="Coordinator" Type="String" /> <asp:Parameter Name="column1" Type="String" /> <asp:Parameter Name="column2" Type="String" /> </InsertParameters> </asp:SqlDataSource></asp:Content> 我觉得这是vs2005的bug,很多new feature只能和sql2005 express一起做,sql2000就不行。 使用MSCOMM32 异常来自 HRESULT:0x800A1F54 C# 操作word出现内存不够的问题 奇怪的,找不到类型或命名空间 问题。 问大家个接口实现的问题 WinForm中的数据库连接 高分求C#视频入门的视频教材下载,谢谢! 博立点菜机接口开发 n天前有个vs.net2003下载,请问用什么安装? 关于Session_OnEnd函数!!急! WinForm窗体包含DataGridView继承后不能修改吗 如何用C#实现将当前用户加到本机管理员组里 如何判断计算机上软件的版本是否是最新版本?
--------------------------------------------------------------------------------Line 1: Incorrect syntax near 'nvarchar'.
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: Line 1: Incorrect syntax near 'nvarchar'.Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace:
[SqlException (0x80131904): Line 1: Incorrect syntax near 'nvarchar'.]
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +95
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +82
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +346
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +3244
System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +186
System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +1121
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +334
System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) +407
System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +149
System.Web.UI.WebControls.SqlDataSourceView.ExecuteDbCommand(DbCommand command, DataSourceOperation operation) +493
System.Web.UI.WebControls.SqlDataSourceView.ExecuteUpdate(IDictionary keys, IDictionary values, IDictionary oldValues) +915
System.Web.UI.DataSourceView.Update(IDictionary keys, IDictionary values, IDictionary oldValues, DataSourceViewOperationCallback callback) +179
System.Web.UI.WebControls.GridView.HandleUpdate(GridViewRow row, Int32 rowIndex, Boolean causesValidation) +1140
System.Web.UI.WebControls.GridView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup) +835
System.Web.UI.WebControls.GridView.OnBubbleEvent(Object source, EventArgs e) +162
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +56
System.Web.UI.WebControls.GridViewRow.OnBubbleEvent(Object source, EventArgs e) +118
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +56
System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +107
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +175
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +31
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +32
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +72
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3839
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42 多谢!!!
<asp:Content ID="Content1" runat="server" ContentPlaceHolderID="ContentPlaceHolder1">
<asp:Label ID="Label1" runat="server" BackColor="LightPink" Font-Bold="True" Font-Underline="False"
ForeColor="SteelBlue" Text="Operation:Configuration:Budget Control Method" Width="378px"></asp:Label><br />
<asp:DetailsView ID="DetailsView2" runat="server" AutoGenerateRows="False" DataKeyNames="site"
DataSourceID="SqlDataSource1" Height="50px" Width="125px">
<Fields>
<asp:BoundField DataField="site" HeaderText="site" ReadOnly="True" SortExpression="site" />
<asp:BoundField DataField="forcase_ww" HeaderText="forcase_ww" SortExpression="forcase_ww" />
<asp:BoundField DataField="Budget_control" HeaderText="Budget_control" SortExpression="Budget_control" />
<asp:BoundField DataField="Approve_method" HeaderText="Approve_method" SortExpression="Approve_method" />
<asp:BoundField DataField="Coordinator" HeaderText="Coordinator" SortExpression="Coordinator" />
<asp:BoundField DataField="cut-off_day" HeaderText="cut-off_day" SortExpression="cut-off_day" />
<asp:BoundField DataField="cut-off_time" HeaderText="cut-off_time" SortExpression="cut-off_time" />
<asp:CommandField ShowEditButton="True" ButtonType="Button" />
</Fields>
</asp:DetailsView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConflictDetection="CompareAllValues"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>" DeleteCommand="DELETE FROM [site_depend_configuration] WHERE [site] = @original_site AND [forcase_ww] = @original_forcase_ww AND [Budget_control] = @original_Budget_control AND [Approve_method] = @original_Approve_method AND [Coordinator] = @original_Coordinator AND [cut-off_day] = @original_column1 AND [cut-off_time] = @original_column2"
InsertCommand="INSERT INTO [site_depend_configuration] ([site], [forcase_ww], [Budget_control], [Approve_method], [Coordinator], [cut-off_day], [cut-off_time]) VALUES (@site, @forcase_ww, @Budget_control, @Approve_method, @Coordinator, @column1, @column2)"
OldValuesParameterFormatString="original_{0}" SelectCommand="SELECT * FROM [site_depend_configuration]"
UpdateCommand="UPDATE [site_depend_configuration] SET [forcase_ww] = @forcase_ww, [Budget_control] = @Budget_control, [Approve_method] = @Approve_method, [Coordinator] = @Coordinator, [cut-off_day] = @column1, [cut-off_time] = @column2 WHERE [site] = @original_site AND [forcase_ww] = @original_forcase_ww AND [Budget_control] = @original_Budget_control AND [Approve_method] = @original_Approve_method AND [Coordinator] = @original_Coordinator AND [cut-off_day] = @original_column1 AND [cut-off_time] = @original_column2" ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>">
<DeleteParameters>
<asp:Parameter Name="original_site" Type="String" />
<asp:Parameter Name="original_forcase_ww" Type="Int32" />
<asp:Parameter Name="original_Budget_control" Type="String" />
<asp:Parameter Name="original_Approve_method" Type="String" />
<asp:Parameter Name="original_Coordinator" Type="String" />
<asp:Parameter Name="original_column1" Type="String" />
<asp:Parameter Name="original_column2" Type="String" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="forcase_ww" Type="Int32" />
<asp:Parameter Name="Budget_control" Type="String" />
<asp:Parameter Name="Approve_method" Type="String" />
<asp:Parameter Name="Coordinator" Type="String" />
<asp:Parameter Name="column1" Type="String" />
<asp:Parameter Name="column2" Type="String" />
<asp:Parameter Name="original_site" Type="String" />
<asp:Parameter Name="original_forcase_ww" Type="Int32" />
<asp:Parameter Name="original_Budget_control" Type="String" />
<asp:Parameter Name="original_Approve_method" Type="String" />
<asp:Parameter Name="original_Coordinator" Type="String" />
<asp:Parameter Name="original_column1" Type="String" />
<asp:Parameter Name="original_column2" Type="String" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="site" Type="String" />
<asp:Parameter Name="forcase_ww" Type="Int32" />
<asp:Parameter Name="Budget_control" Type="String" />
<asp:Parameter Name="Approve_method" Type="String" />
<asp:Parameter Name="Coordinator" Type="String" />
<asp:Parameter Name="column1" Type="String" />
<asp:Parameter Name="column2" Type="String" />
</InsertParameters>
</asp:SqlDataSource>
</asp:Content>