473,396 Members | 1,966 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Error Updating SQL DB

1
Hey guys,
Am new at using ASP.Net. am having some problems updating my SQL DB. whenever i try i get this Error. Can someone help me?

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: 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): Incorrect syntax near 'nvarchar'.]
System.Data.SqlClient.SqlConnection.OnError(SqlExc eption exception, Boolean breakConnection) +177
System.Data.SqlClient.SqlInternalConnection.OnErro r(SqlException exception, Boolean breakConnection) +68
System.Data.SqlClient.TdsParser.ThrowExceptionAndW arning(TdsParserStateObject stateObj) +199
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2305
System.Data.SqlClient.SqlCommand.FinishExecuteRead er(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +147
System.Data.SqlClient.SqlCommand.RunExecuteReaderT ds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +1021
System.Data.SqlClient.SqlCommand.RunExecuteReader( CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +314
System.Data.SqlClient.SqlCommand.InternalExecuteNo nQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) +413
System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +115
System.Web.UI.WebControls.SqlDataSourceView.Execut eDbCommand(DbCommand command, DataSourceOperation operation) +392
System.Web.UI.WebControls.SqlDataSourceView.Execut eUpdate(IDictionary keys, IDictionary values, IDictionary oldValues) +643
System.Web.UI.DataSourceView.Update(IDictionary keys, IDictionary values, IDictionary oldValues, DataSourceViewOperationCallback callback) +78
System.Web.UI.WebControls.FormView.HandleUpdate(St ring commandArg, Boolean causesValidation) +1151
System.Web.UI.WebControls.FormView.HandleEvent(Eve ntArgs e, Boolean causesValidation, String validationGroup) +450
System.Web.UI.WebControls.FormView.OnBubbleEvent(O bject source, EventArgs e) +88
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35
System.Web.UI.WebControls.FormViewRow.OnBubbleEven t(Object source, EventArgs e) +109
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35
System.Web.UI.WebControls.LinkButton.OnCommand(Com mandEventArgs e) +86
System.Web.UI.WebControls.LinkButton.RaisePostBack Event(String eventArgument) +156
System.Web.UI.WebControls.LinkButton.System.Web.UI .IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +172
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4921


Here is my code

<%@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="LostAndFound.aspx.vb" Inherits="Default2" title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<table>
<tr>
<td style="width: 312px; height: 5px">
</td>
<td style="width: 100px; height: 5px">
</td>
<td style="width: 100px; height: 5px">
</td>
<td style="width: 100px; height: 5px">
</td>
</tr>
<tr>
<td style="width: 312px; height: 25px">
</td>
<td colspan="2" style="height: 25px; text-align: center">
<strong><span style="font-size: 16pt; color: olive; font-family: Verdana">Lost and Found</span></strong></td>
<td style="width: 100px; height: 25px">
</td>
</tr>
<tr>
<td style="width: 312px; height: 257px">
</td>
<td colspan="2" style="height: 257px; vertical-align: top; text-align: left;">
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
<asp:FormView ID="FormView1" runat="server" CellPadding="4" DataKeyNames="Item ID"
DataSourceID="SqlDataSource1" ForeColor="#333333">
<FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
<EditItemTemplate>
<table>
<tr>
<td style="width: 156px">
Item ID:
</td>
<td style="width: 100px">
<asp:Label ID="Item_IDLabel1" runat="server" Text='<%# Eval("[Item ID]") %>'></asp:Label></td>
</tr>
<tr>
<td style="width: 156px">
Date:</td>
<td style="width: 100px">
<asp:TextBox ID="DateTextBox" runat="server" Text='<%# Bind("Date") %>'></asp:TextBox></td>
</tr>
<tr>
<td style="width: 156px">
Book Title:</td>
<td style="width: 100px">
<asp:TextBox ID="Book_TitleTextBox" runat="server" Text='<%# Bind("[Book Title]") %>'></asp:TextBox></td>
</tr>
<tr>
<td style="width: 156px">
Book Number:
</td>
<td style="width: 100px">
<asp:TextBox ID="Book_NumberTextBox" runat="server" Text='<%# Bind("[Book Number]") %>'></asp:TextBox></td>
</tr>
<tr>
<td style="width: 156px">
Student Name:
</td>
<td style="width: 100px">
<asp:TextBox ID="Student_NameTextBox" runat="server" Text='<%# Bind("[Student Name]") %>'></asp:TextBox></td>
</tr>
<tr>
<td style="width: 156px">
Grade:
</td>
<td style="width: 100px">
<asp:TextBox ID="GradeTextBox" runat="server" Text='<%# Bind("Grade") %>'></asp:TextBox></td>
</tr>
<tr>
<td style="width: 156px">
Date Recieved:
</td>
<td style="width: 100px">
<asp:TextBox ID="Date_RecievedTextBox" runat="server" Text='<%# Bind("[Date Recieved]") %>'></asp:TextBox></td>
</tr>
<tr>
<td colspan="2">
<asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update"
Text="Update"></asp:LinkButton>
<asp:LinkButton ID="UpdateCancelButton" runat="server" CausesValidation="False" CommandName="Cancel"
Text="Cancel"></asp:LinkButton></td>
</tr>
</table>
</EditItemTemplate>
<RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
<PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" />
<InsertItemTemplate>
<table>
<tr>
<td style="width: 153px">
Date:
</td>
<td style="width: 100px">
<asp:TextBox ID="DateTextBox" runat="server" Text='<%# Bind("Date") %>'></asp:TextBox></td>
</tr>
<tr>
<td style="width: 153px">
Book Title:</td>
<td style="width: 100px">
<asp:TextBox ID="Book_TitleTextBox" runat="server" Text='<%# Bind("[Book Title]") %>'></asp:TextBox></td>
</tr>
<tr>
<td style="width: 153px">
Book Number:</td>
<td style="width: 100px">
<asp:TextBox ID="Book_NumberTextBox" runat="server" Text='<%# Bind("[Book Number]") %>'></asp:TextBox></td>
</tr>
<tr>
<td style="width: 153px">
Student Name:
</td>
<td style="width: 100px">
<asp:TextBox ID="Student_NameTextBox" runat="server" Text='<%# Bind("[Student Name]") %>'></asp:TextBox></td>
</tr>
<tr>
<td style="width: 153px">
Grade:</td>
<td style="width: 100px">
<asp:TextBox ID="GradeTextBox" runat="server" Text='<%# Bind("Grade") %>'></asp:TextBox></td>
</tr>
<tr>
<td style="width: 153px">
Date Recieved:</td>
<td style="width: 100px">
<asp:TextBox ID="Date_RecievedTextBox" runat="server" Text='<%# Bind("[Date Recieved]") %>'></asp:TextBox></td>
</tr>
<tr>
<td colspan="2">
<asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert"
Text="Insert"></asp:LinkButton>
<asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False" CommandName="Cancel"
Text="Cancel"></asp:LinkButton></td>
</tr>
</table>
</InsertItemTemplate>
<ItemTemplate>
<table>
<tr>
<td style="width: 138px">
Item ID:
</td>
<td style="width: 108px">
<asp:Label ID="Item_IDLabel" runat="server" Text='<%# Eval("[Item ID]") %>'></asp:Label></td>
</tr>
<tr>
<td style="width: 138px">
Date:
</td>
<td style="width: 108px">
<asp:Label ID="DateLabel" runat="server" Text='<%# Bind("Date") %>'></asp:Label></td>
</tr>
<tr>
<td style="width: 138px">
Book Title:</td>
<td style="width: 108px">
<asp:Label ID="Book_TitleLabel" runat="server" Text='<%# Bind("[Book Title]") %>'
Width="175px"></asp:Label></td>
</tr>
<tr>
<td style="width: 138px">
Book Number:
</td>
<td style="width: 108px">
<asp:Label ID="Book_NumberLabel" runat="server" Text='<%# Bind("[Book Number]") %>'></asp:Label></td>
</tr>
<tr>
<td style="width: 138px">
Student Name:
</td>
<td style="width: 108px">
<asp:Label ID="Student_NameLabel" runat="server" Text='<%# Bind("[Student Name]") %>'></asp:Label></td>
</tr>
<tr>
<td style="width: 138px">
Grade:</td>
<td style="width: 108px">
<asp:Label ID="GradeLabel" runat="server" Text='<%# Bind("Grade") %>'></asp:Label></td>
</tr>
<tr>
<td style="width: 138px">
Date Recieved:</td>
<td style="width: 108px">
<asp:Label ID="Date_RecievedLabel" runat="server" Text='<%# Bind("[Date Recieved]") %>'></asp:Label></td>
</tr>
<tr>
<td colspan="2">
<asp:LinkButton ID="EditButton" runat="server" CausesValidation="False" CommandName="Edit"
Text="Edit"></asp:LinkButton>
<asp:LinkButton ID="DeleteButton" runat="server" CausesValidation="False" CommandName="Delete"
Text="Delete"></asp:LinkButton>
<asp:LinkButton ID="NewButton" runat="server" CausesValidation="False" CommandName="New"
Text="New"></asp:LinkButton></td>
</tr>
</table>
</ItemTemplate>
<HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
<HeaderTemplate>
<span style="font-size: 16pt; color: #ffffff; font-family: Verdana">Lost and Found</span>
</HeaderTemplate>
</asp:FormView>
&nbsp;
</td>
<td style="width: 100px; height: 257px">
</td>
</tr>
<tr>
<td style="width: 312px; height: 44px; text-align: right">
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
<asp:HyperLink ID="HyperLink1" runat="server" Font-Bold="True" Font-Names="Verdana"
Font-Size="Smaller" ImageUrl="~/Images/back.gif" NavigateUrl="~/Admin/Admin.aspx"
Style="text-align: right" Target="_parent"><< Back</asp:HyperLink></td>
<td style="width: 100px; height: 44px">
</td>
<td style="width: 100px; height: 44px">
</td>
<td style="width: 100px; height: 44px">
</td>
</tr>
</table>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConflictDetection="CompareAllValues"
ConnectionString="<%$ ConnectionStrings:CortexConnectionString41 %>" DeleteCommand="DELETE FROM [LOST_FOUND] WHERE [Item ID] = @original_Item_ID AND [Date] = @original_Date AND [Book Title] = @original_Book_Title AND [Book Number] = @original_Book_Number AND [Student Name] = @original_Student_Name AND [Grade] = @original_Grade AND [Date Recieved] = @original_Date_Recieved"
InsertCommand="INSERT INTO [LOST_FOUND] ([Date], [Book Title], [Book Number], [Student Name], [Grade], [Date Recieved]) VALUES (@Date, @Book_Title, @Book_Number, @Student_Name, @Grade, @Date_Recieved)"
OldValuesParameterFormatString="{0}" SelectCommand="SELECT * FROM [LOST_FOUND] ORDER BY [Date]"
UpdateCommand="UPDATE [LOST_FOUND] SET [Date] = @Date, [Book Title] = @Book_Title, [Book Number] = @Book_Number, [Student Name] = @Student_Name, [Grade] = @Grade, [Date Recieved] = @Date_Recieved WHERE [Item ID] = @original_Item_ID AND [Date] = @original_Date AND [Book Title] = @original_Book_Title AND [Book Number] = @original_Book_Number AND [Student Name] = @original_Student_Name AND [Grade] = @original_Grade AND [Date Recieved] = @original_Date_Recieved">
<DeleteParameters>
<asp:Parameter Name="original_Item_ID" Type="Int32" />
<asp:Parameter Name="original_Date" Type="String" />
<asp:Parameter Name="original_Book_Title" Type="String" />
<asp:Parameter Name="original_Book_Number" Type="String" />
<asp:Parameter Name="original_Student_Name" Type="String" />
<asp:Parameter Name="original_Grade" Type="String" />
<asp:Parameter Name="original_Date_Recieved" Type="String" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="Date" Type="String" />
<asp:Parameter Name="Book_Title" Type="String" />
<asp:Parameter Name="Book_Number" Type="String" />
<asp:Parameter Name="Student_Name" Type="String" />
<asp:Parameter Name="Grade" Type="String" />
<asp:Parameter Name="Date_Recieved" Type="String" />
<asp:Parameter Name="original_Item_ID" Type="Int32" />
<asp:Parameter Name="original_Date" Type="String" />
<asp:Parameter Name="original_Book_Title" Type="String" />
<asp:Parameter Name="original_Book_Number" Type="String" />
<asp:Parameter Name="original_Student_Name" Type="String" />
<asp:Parameter Name="original_Grade" Type="String" />
<asp:Parameter Name="original_Date_Recieved" Type="String" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="Date" Type="String" />
<asp:Parameter Name="Book_Title" Type="String" />
<asp:Parameter Name="Book_Number" Type="String" />
<asp:Parameter Name="Student_Name" Type="String" />
<asp:Parameter Name="Grade" Type="String" />
<asp:Parameter Name="Date_Recieved" Type="String" />
</InsertParameters>
</asp:SqlDataSource>
</asp:Content>

Jun 25 '07 #1
3 1848
kenobewan
4,871 Expert 4TB
Welcome to TSDN. I'm not sure why you pasted so much code. You'll need to debug the sql and work out which variable is the problem, I can't tell which it is by your code.
Jun 25 '07 #2
Wing
28
Your error is going to be on LostAndFound.aspx.vb dealing with SQL statement near 'nvarchar' Since you are using ASP use Response.Write to display your SQL statement before committing it the database.
Jun 25 '07 #3
Frinavale
9,735 Expert Mod 8TB
That certainly is a lot of code!
What we really need to see is your VB code (not the HTML) that you have written to connect to your database.

Please only post that code snippet and please use [code=vbnet] ...your code [ /code]

Thanks

-Frinny
Jun 25 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: AIM | last post by:
Error in msvc in building inheritance.obj to build hello.pyd Hello, I am trying to build the boost 1.31.0 sample extension hello.cpp. I can not compile the file inheritance.cpp because the two...
5
by: azgoddess1 | last post by:
During the installation I get these error messages: ***** SQL1390C The environment variable DB2Instance is not defined or is invalid An error ocured while loading the command "C:\Program...
18
by: Steve | last post by:
Hi I have a really weird problem and any assistance would be welcome. I have developed an app in Access 2002. The app runs perfectly on the development machine. I have packaged the app using...
0
by: Ryan Dawson | last post by:
Hello. I am getting an error when trying to remove/access items inside of a listview: System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. Parameter...
6
by: akoymakoy | last post by:
Run time error 3251 Current Recordset does not support updating, this may be a limitation of the provider, or of the selected Locktype This is my simple program that will split the entries that...
3
by: amatuer | last post by:
ADODB.Recordset error '800a0cb3' Current Recordset does not support updating. This may be a limitation of the provider, or of the selected locktype. /devag/newProjSave.asp, line 321 ...
10
by: Mike | last post by:
I have code that is doing some updating to a record. Its getting the ID to update from the Grid. I'm passing an INT to my method to update the record. My code is working though I'm still getting an...
0
by: mbenedict | last post by:
I am rather new at this code and am attempting to modify existing code to use clob datatypes, which I have never used before. The database tables have been set up for clob data. When trying to use...
0
by: Toralf Kirsten | last post by:
Hi all, we have installed DB2 V9.5 Trial on a Fedora 6 Linux box (32bit). Since the box is included in a NIS we have manually created db2 users db2inst, dasusr and db2fenc on this box (not in the...
2
by: Smurfas | last post by:
What's wrong? Compiletor don't show anything, but whet I start program show this error: "Error updating the employee details!" protected void Button1_Click(object sender, EventArgs e) ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.