Incorrect syntax near 'nvarchar'.

  • Thread starter Thread starter Mark B
  • Start date Start date
M

Mark B

When I click the 'Update' button on a ASP.Net 3.5 GridView record, I get an
error:

Incorrect syntax near 'nvarchar'.

Everything else there works OK. Here is the code:


<%@ Page Language="VB" AutoEventWireup="false" CodeFile="default.aspx.vb"
Inherits="pages_verify_groups_Default" Debug="true"
MasterPageFile="~/pages/master_page/MasterPage.master"
Title="Page1"%>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolderMain1"
Runat="Server">

</tr><tr><td><h2>


Title</h2>
<p>


<asp:GridView
ID="GridView1" runat="server" AutoGenerateColumns="False"
DataSourceID="SqlDataSource1"
AllowPaging="True" AllowSorting="True">
<Columns>
<asp:CommandField
ShowEditButton="True" />
<asp:BoundField
DataField="ID" HeaderText="ID" InsertVisible="False"
ReadOnly="True"
SortExpression="ID" />
<asp:BoundField
DataField="Language" HeaderText="Language"
SortExpression="Language"
/>
<asp:BoundField
DataField="English ID" HeaderText="English ID"
SortExpression="English
ID" />
<asp:BoundField
DataField="English" HeaderText="English"
SortExpression="English"
/>
<asp:BoundField
DataField="Text" HeaderText="Text" SortExpression="Text" />
</Columns>
</asp:GridView>
<asp:SqlDataSource
ID="SqlDataSource1" runat="server"
ConnectionString="<%$
ConnectionStrings:MyConnectionString %>"

SelectCommand="SELECT
tblLanguageValues.AutoNumberID AS ID, tblLanguageValues.LanguageCode AS
Language, tblLanguageValues.LookupID AS [English ID],
tblLanguageValues_1.LanguageText AS English, tblLanguageValues.LanguageText
AS Text FROM tblLanguageValues INNER JOIN tblLanguageValues AS
tblLanguageValues_1 ON tblLanguageValues.LookupID =
tblLanguageValues_1.AutoNumberID WHERE (tblLanguageValues.LanguageCode =
'FR-FR')"

UpdateCommand="UPDATE
tblLanguageValues SET LanguageText = @LanguageText WHERE (LanguageCode =
@LanguageCode) AND (LookupID = @LookupID)">
<UpdateParameters>
<asp:Parameter
Name="LanguageText" type="String" />
<asp:Parameter
Name="LanguageCode" type="String"/>
<asp:Parameter
Name="LookupID" type="Int32" />
</UpdateParameters>
</asp:SqlDataSource>
</p>
</td>
</tr>
<tr>
<td>
<p>
</p>
</td>
</tr>
<tr>
<td>
&nbsp;</td>
</tr>
<tr>
<td>

</td>
</tr>
<tr>
<td>
&nbsp;</td>
</tr>
<tr>
<td>
&nbsp;</td>
</tr>
<tr>
<td>
&nbsp;</td>
</tr>
</asp:Content>
<asp:Content ID="Content2" runat="server" contentplaceholderid="head">

</asp:Content>
 
UPDATE [dbo].[tblLanguageValues]
SET [LanguageCode] = <LanguageCode, varchar(10),>
,[LookupID] = <LookupID, int,>
,[LanguageText] = <LanguageText, nvarchar(4000),>
WHERE <Search Conditions,,>


SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[tblLanguageValues](
[AutoNumberID] [int] IDENTITY(1,1) NOT NULL,
[LanguageCode] [varchar](10) NOT NULL CONSTRAINT
[DF_tblLanguageValues_LanguageCode] DEFAULT ('EN-US'),
[LookupID] [int] NOT NULL,
[LanguageText] [nvarchar](4000) NOT NULL,
CONSTRAINT [PK_tblLanguageValues] PRIMARY KEY CLUSTERED
(
[LanguageCode] ASC,
[LookupID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY =
OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
 
Back
Top