473,394 Members | 1,916 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,394 software developers and data experts.

Incorrect syntax near 'nvarchar'.

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>

Aug 6 '08 #1
2 4135
Hi

This is a invalid sql string message... your update sql string have
some problem...
check that your database columns datatype and sql string is good...

Best of luck

-------
Munna

www.munna.shatkotha.com/blog
www.munna.shatkotha.com
www.shatkotha.com
Aug 6 '08 #2

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


"Munna" <mu******@gmail.comwrote in message
news:21**********************************@s50g2000 hsb.googlegroups.com...
Hi

This is a invalid sql string message... your update sql string have
some problem...
check that your database columns datatype and sql string is good...

Best of luck

-------
Munna

www.munna.shatkotha.com/blog
www.munna.shatkotha.com
www.shatkotha.com
Aug 6 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: GitarJake | last post by:
Hello all, Newbie here. SQL 2000, Windows 2000 I'm trying to alter tables in my SQL DB using statements like the following: /* AD_GROUPS */ alter table AD_GROUPS alter column...
1
by: Jeff Magouirk | last post by:
Dear Group, I am trying to create a view and keep getting the Incorrect syntax near the keyword 'Declare'" error. Here is the code I am writing. Create view fixed_airs (sid, fad_a2, fad_a3)...
1
by: Sandesh | last post by:
Hello All, Me saying " has any body come across such error would be underestimating". Well I am getting a very peculiar and unique error "Line 1: Incorrect syntax near 'Actions'." ...
1
by: iporter | last post by:
In the following code, the two Response.Write statements output exactly the same - I can copy and paste both into Query Analyzer, and run them fine. However, if I comment out line 3, the...
3
by: wallic | last post by:
Hello, This is my first post and I am a beginner with SQL code. The code below is supposed to update a new table (loctable) with a calculated value based on the original table (hra_data). ...
0
by: roamnet | last post by:
hi i created database file with .mdf extention ,sql server as a source and use grid view to display data there're no problem in data retrieve and display,but i want to edit it or insert new...
10
by: arial | last post by:
Hi, I am getting this error message: Incorrect syntax near the keyword 'where'. Description: An unhandled exception occurred during the execution of the current web request. Please review...
1
by: karenkksh | last post by:
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. ...
1
by: asf93555 | last post by:
Running under SQL2000 I can not get an INSTEAD trigger to function. I've even copied the example directl from books online - no joy . . . Server: Msg 170, Level 15, State 1, Procedure...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.