[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Editing/Updating in ASP.NET

Posted on 2007-10-18
2
Medium Priority
?
1,371 Views
Last Modified: 2012-08-14
I keep getting an error message when trying to edit/update my SQL Db through ASP.NET. The update and delete buttons were made through Microsoft Expression Web. Any ideas?  

 <asp:GridView runat="server" id="GridView1" AutoGenerateColumns="False" DataSourceID="SwoopSQL"  DataKeyNames="Office_ID" AllowSorting="True" ForeColor="#333333" CellPadding="4" GridLines="None" Height="175px">
            <FooterStyle BackColor="#5D7B9D" ForeColor="White" Font-Bold="True" />
            <Columns>
                  <asp:commandfield ShowEditButton="True">
                  </asp:commandfield>
                  <asp:boundfield ReadOnly="True" DataField="Office_ID" SortExpression="Office_ID" HeaderText="ID">
                  </asp:boundfield>
                  <asp:checkboxfield DataField="Swoop7" SortExpression="Swoop7" HeaderText="Swoop7">
                  </asp:checkboxfield>
                  <asp:checkboxfield DataField="DHCP/WPA" SortExpression="DHCP/WPA" HeaderText="DHCP/WPA">
                  </asp:checkboxfield>
                  <asp:checkboxfield DataField="WinPrinting" SortExpression="WinPrinting" HeaderText="WinPrinting">
                  </asp:checkboxfield>
                  <asp:checkboxfield DataField="Equip_Log" SortExpression="Equip_Log" HeaderText="Equip_Log">
                  </asp:checkboxfield>
                  <asp:checkboxfield DataField="Switch_Config" SortExpression="Switch_Config" HeaderText="Switch_Config">
                  </asp:checkboxfield>
                  <asp:checkboxfield DataField="Labels" SortExpression="Labels" HeaderText="Labels">
                  </asp:checkboxfield>
                  <asp:checkboxfield DataField="Wire_Closet" SortExpression="Wire_Closet" HeaderText="Wire_Closet">
                  </asp:checkboxfield>
            </Columns>
            <RowStyle BackColor="#F7F6F3" ForeColor="#0f225c" />
            <EditRowStyle BackColor="#999999" />
            <SelectedRowStyle BackColor="#E2DED6" ForeColor="#333333" Font-Bold="True" />
            <PagerStyle BackColor="#0f225c" ForeColor="White" HorizontalAlign="Center" />
            <HeaderStyle BackColor="#0f225c" ForeColor="White" Font-Bold="True" />
            <AlternatingRowStyle BackColor="White" ForeColor="#0f225c" />
      </asp:GridView>
      <asp:SqlDataSource runat="server" ID="SwoopSQL" DeleteCommand="DELETE FROM [Swoop7 Checklist] WHERE [Office_ID] = @original_Office_ID AND [Swoop7] = @original_Swoop7 AND [DHCP/WPA] = @original_column1 AND [WinPrinting] = @original_WinPrinting AND [Equip_Log] = @original_Equip_Log AND [Switch_Config] = @original_Switch_Config AND [Labels] = @original_Labels AND [Wire_Closet] = @original_Wire_Closet" ConnectionString="<%$ ConnectionStrings:PRLConnectionString %>" InsertCommand="INSERT INTO [Swoop7 Checklist] ([Swoop7], [DHCP/WPA], [WinPrinting], [Equip_Log], [Switch_Config], [Labels], [Wire_Closet]) VALUES (@Swoop7, @column1, @WinPrinting, @Equip_Log, @Switch_Config, @Labels, @Wire_Closet)" UpdateCommand="UPDATE [Swoop7 Checklist] SET [Swoop7] = @Swoop7, [DHCP/WPA] = @column1, [WinPrinting] = @WinPrinting, [Equip_Log] = @Equip_Log, [Switch_Config] = @Switch_Config, [Labels] = @Labels, [Wire_Closet] = @Wire_Closet WHERE [Office_ID] = @original_Office_ID AND [Swoop7] = @original_Swoop7 AND [DHCP/WPA] = @original_column1 AND [WinPrinting] = @original_WinPrinting AND [Equip_Log] = @original_Equip_Log AND [Switch_Config] = @original_Switch_Config AND [Labels] = @original_Labels AND [Wire_Closet] = @original_Wire_Closet" OldValuesParameterFormatString="original_{0}" ConflictDetection="CompareAllValues" SelectCommand="SELECT * FROM [Swoop7 Checklist] ORDER BY [Office_ID]">
            <DeleteParameters>
                  <asp:parameter Type="Int32" Name="original_Office_ID" />
                  <asp:parameter Type="Boolean" Name="original_Swoop7" />
                  <asp:parameter Type="Boolean" Name="original_column1" />
                  <asp:parameter Type="Boolean" Name="original_WinPrinting" />
                  <asp:parameter Type="Boolean" Name="original_Equip_Log" />
                  <asp:parameter Type="Boolean" Name="original_Switch_Config" />
                  <asp:parameter Type="Boolean" Name="original_Labels" />
                  <asp:parameter Type="Boolean" Name="original_Wire_Closet" />
            </DeleteParameters>
            <UpdateParameters>
                  <asp:parameter Type="Boolean" Name="Swoop7" />
                  <asp:parameter Type="Boolean" Name="column1" />
                  <asp:parameter Type="Boolean" Name="WinPrinting" />
                  <asp:parameter Type="Boolean" Name="Equip_Log" />
                  <asp:parameter Type="Boolean" Name="Switch_Config" />
                  <asp:parameter Type="Boolean" Name="Labels" />
                  <asp:parameter Type="Boolean" Name="Wire_Closet" />
                  <asp:parameter Type="Int32" Name="original_Office_ID" />
                  <asp:parameter Type="Boolean" Name="original_Swoop7" />
                  <asp:parameter Type="Boolean" Name="original_column1" />
                  <asp:parameter Type="Boolean" Name="original_WinPrinting" />
                  <asp:parameter Type="Boolean" Name="original_Equip_Log" />
                  <asp:parameter Type="Boolean" Name="original_Switch_Config" />
                  <asp:parameter Type="Boolean" Name="original_Labels" />
                  <asp:parameter Type="Boolean" Name="original_Wire_Closet" />
            </UpdateParameters>
            <InsertParameters>
                  <asp:parameter Type="Boolean" Name="Swoop7" />
                  <asp:parameter Type="Boolean" Name="column1" />
                  <asp:parameter Type="Boolean" Name="WinPrinting" />
                  <asp:parameter Type="Boolean" Name="Equip_Log" />
                  <asp:parameter Type="Boolean" Name="Switch_Config" />
                  <asp:parameter Type="Boolean" Name="Labels" />
                  <asp:parameter Type="Boolean" Name="Wire_Closet" />
            </InsertParameters>
      </asp:SqlDataSource>
0
Comment
Question by:prlit
2 Comments
 
LVL 11

Accepted Solution

by:
cmhunty earned 1500 total points
ID: 20101573
What's the full error message/line number etc? Is the error in the SQL or in the ASP.NET?
0
 
LVL 1

Author Comment

by:prlit
ID: 20108089
Server Error in '/test2' Application.
--------------------------------------------------------------------------------

Incorrect syntax near '/'.
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: Incorrect syntax near '/'.

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): Incorrect syntax near '/'.]
   System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +862234
   System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +739110
   System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +188
   System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +1956
   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
 
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
This shares a stored procedure to retrieve permissions for a given user on the current database or across all databases on a server.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Suggested Courses

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question