Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / February 2008

Tip: Looking for answers? Try searching our database.

GridView Update

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Looch - 15 Feb 2008 15:20 GMT
Hi,

I'm filling a GridView with a simple sproc select statement. I'm
trying to use the Update tab to create an update statement and using
the following:

Update Shipping_Requests
Set Shipped = @Shipped

The Shipped column is a bit type column that is returned in the
initial sproc call to fill the GridView. I'm getting the error:

"Incorrect syntax near 'nvarchar'" when trying to update the row.

The stack trace is below. This seems like a no brainer but I can't
seem to get it to work. Any ideas? Thanks in advance.

[SqlException (0x80131904): Incorrect syntax near 'nvarchar'.]
  System.Data.SqlClient.SqlConnection.OnError(SqlException exception,
Boolean breakConnection) +859322
  System.Data.SqlClient.SqlInternalConnection.OnError(SqlException
exception, Boolean breakConnection) +736198

System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject
stateObj) +188
  System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior,
SqlCommand cmdHandler, SqlDataReader dataStream,
BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject
stateObj) +1959
  System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader
ds, RunBehavior runBehavior, String resetOptionsString) +149

System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior
cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean
async) +903
  System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior
cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String
method, DbAsyncResult result) +132

System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult
result, String methodName, Boolean sendToPipe) +415
  System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +135

System.Web.UI.WebControls.SqlDataSourceView.ExecuteDbCommand(DbCommand
command, DataSourceOperation operation) +401

System.Web.UI.WebControls.SqlDataSourceView.ExecuteUpdate(IDictionary
keys, IDictionary values, IDictionary oldValues) +721
  System.Web.UI.DataSourceView.Update(IDictionary keys, IDictionary
values, IDictionary oldValues, DataSourceViewOperationCallback
callback) +78
  System.Web.UI.WebControls.GridView.HandleUpdate(GridViewRow row,
Int32 rowIndex, Boolean causesValidation) +1215
  System.Web.UI.WebControls.GridView.HandleEvent(EventArgs e, Boolean
causesValidation, String validationGroup) +858
  System.Web.UI.WebControls.GridView.OnBubbleEvent(Object source,
EventArgs e) +95
  System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs
args) +35
  System.Web.UI.WebControls.GridViewRow.OnBubbleEvent(Object source,
EventArgs e) +117
  System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs
args) +35
  System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e)
+115
  System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String
eventArgument) +163

System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String
eventArgument) +7
  System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument) +11
  System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
+174
  System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
+5102
Angel - 15 Feb 2008 21:10 GMT
Your sql is not correct but I can't tell with out looking at your code.  Post
some code.

I have working examples of the products table in Northwind and the sql looks
like this
"Update products set discontinued ='true'... this is working just fine and
discontinued is a bit datatype.

Signature

aaa

> Hi,
>
[quoted text clipped - 73 lines]
> includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
> +5102
David C - 18 Feb 2008 14:26 GMT
Try using 1 for true and 0 for false conditions.
> Hi,
>
[quoted text clipped - 73 lines]
> includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
> +5102

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.