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>
<asparameter
Name="LanguageText" type="String" />
<asparameter
Name="LanguageCode" type="String"/>
<asparameter
Name="LookupID" type="Int32" />
</UpdateParameters>
</asp:SqlDataSource>
</p>
</td>
</tr>
<tr>
<td>
<p>
</p>
</td>
</tr>
<tr>
<td>
</td>
</tr>
<tr>
<td>
</td>
</tr>
<tr>
<td>
</td>
</tr>
<tr>
<td>
</td>
</tr>
<tr>
<td>
</td>
</tr>
</asp:Content>
<asp:Content ID="Content2" runat="server" contentplaceholderid="head">
</asp:Content>
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>
<asparameter
Name="LanguageText" type="String" />
<asparameter
Name="LanguageCode" type="String"/>
<asparameter
Name="LookupID" type="Int32" />
</UpdateParameters>
</asp:SqlDataSource>
</p>
</td>
</tr>
<tr>
<td>
<p>
</p>
</td>
</tr>
<tr>
<td>
</td>
</tr>
<tr>
<td>
</td>
</tr>
<tr>
<td>
</td>
</tr>
<tr>
<td>
</td>
</tr>
<tr>
<td>
</td>
</tr>
</asp:Content>
<asp:Content ID="Content2" runat="server" contentplaceholderid="head">
</asp:Content>