473,659 Members | 2,663 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Incorrect syntax near '('.

Can you tell me what is wrong with this syntax ?
string select = "UPDATE [PME].[dbo].[Expense] " +
"([ID],[ClientID],[Total],[TPS],[TVQ],[Gtotal],[DateFAC],
[DatePAY],[Description],[fl_type],[fl_status],
[fl_category],[fl_source],[defaut], [Cheque],
[fl_taxable], [notaxe], [id]) " +
" VALUES
(@id,@clientid, @total,@tps,@tv q,@gtotal,@date fac,@datepay,
@description,@f ltype,@flstatus ,@flcategory,@f lsource,@defa
ut,@cheque,@flt axable,@notaxe, @id) " +
" WHERE id = @id";

I receive the following error,

Additional information:
System.Web.Serv ices.Protocols. SoapException: Server was
unable to process request. --->
System.Data.Sql Client.SqlExcep tion: Line 1: Incorrect
syntax near '('.
at System.Data.Sql Client.SqlComma nd.ExecuteReade r
(CommandBehavio r cmdBehavior, RunBehavior runBehavior,
Boolean returnStream)
at System.Data.Sql Client.SqlComma nd.ExecuteNonQu ery()
at WS_PME.DB.SqlGe nericExecute(St ring sqlquery, String
tablename, String ConfigConnectio nKey, String fonction,
Object[,] aParameter) in F:\Structure\Pr ojets\VS2003
\PME\WS_PME\Com ponents\DB_data set.cs:line 181
at WS_PME.DB.Updat e_Expense(Strin g vClientID, Decimal
vTotal, Decimal vTPS, Decimal vTVQ, Decimal vGtotal,
DateTime vDateFac, DateTime vDatePay, String
vDescription, Int32 vFlType, Int32 vFlStatus, Int32
vFlCategory, Int32 vFlSource, Boolean vDEFAUT, String
vCheque, Int32 vTAXABLE, Decimal vNoTaxe, Guid vID) in
F:\Structure\Pr ojets\VS2003
\PME\WS_PME\Com ponents\DB_data set.cs:line 298
at WS_PME.WSPME.Up dateExpense(Str ing vClientID,
Decimal vTotal, Decimal vTPS, Decimal vTVQ, Decimal
vGtotal, DateTime vDateFac, DateTime vDatePay, String
vDescription, Int32 vFlType, Int32 vFlStatus, Int32
vFlCategory, Int32 vFlSource, Boolean vDEFAUT, String
vCHEQUE, Int32 vTAXABLE, Decimal vNoTaxe, Guid vID) in
F:\Structure\Pr ojets\VS2003\PM E\WS_PME\PME.as mx.cs:line 99
--- End of inner exception stack trace ---
Nov 15 '05 #1
4 9906
try instead:

string update = "UPDATE [PME].[dbo].[Expense] " +
"SET [ID] = @id, [ClientID] = @clientid, " + (etc!)
"WHERE id = @id";

Regards,
Matt
string select = "UPDATE [PME].[dbo].[Expense] " +
"([ID],[ClientID],[Total],[TPS],[TVQ],[Gtotal],[DateFAC],
[DatePAY],[Description],[fl_type],[fl_status],
[fl_category],[fl_source],[defaut], [Cheque],
[fl_taxable], [notaxe], [id]) " +
" VALUES
(@id,@clientid, @total,@tps,@tv q,@gtotal,@date fac,@datepay,
@description,@f ltype,@flstatus ,@flcategory,@f lsource,@defa
ut,@cheque,@flt axable,@notaxe, @id) " +
" WHERE id = @id";

"Carl" <ca**@cb-cinc.com> wrote in message
news:14******** *************** ******@phx.gbl. .. Can you tell me what is wrong with this syntax ?
string select = "UPDATE [PME].[dbo].[Expense] " +
"([ID],[ClientID],[Total],[TPS],[TVQ],[Gtotal],[DateFAC],
[DatePAY],[Description],[fl_type],[fl_status],
[fl_category],[fl_source],[defaut], [Cheque],
[fl_taxable], [notaxe], [id]) " +
" VALUES
(@id,@clientid, @total,@tps,@tv q,@gtotal,@date fac,@datepay,
@description,@f ltype,@flstatus ,@flcategory,@f lsource,@defa
ut,@cheque,@flt axable,@notaxe, @id) " +
" WHERE id = @id";

I receive the following error,

Additional information:
System.Web.Serv ices.Protocols. SoapException: Server was
unable to process request. --->
System.Data.Sql Client.SqlExcep tion: Line 1: Incorrect
syntax near '('.
at System.Data.Sql Client.SqlComma nd.ExecuteReade r
(CommandBehavio r cmdBehavior, RunBehavior runBehavior,
Boolean returnStream)
at System.Data.Sql Client.SqlComma nd.ExecuteNonQu ery()
at WS_PME.DB.SqlGe nericExecute(St ring sqlquery, String
tablename, String ConfigConnectio nKey, String fonction,
Object[,] aParameter) in F:\Structure\Pr ojets\VS2003
\PME\WS_PME\Com ponents\DB_data set.cs:line 181
at WS_PME.DB.Updat e_Expense(Strin g vClientID, Decimal
vTotal, Decimal vTPS, Decimal vTVQ, Decimal vGtotal,
DateTime vDateFac, DateTime vDatePay, String
vDescription, Int32 vFlType, Int32 vFlStatus, Int32
vFlCategory, Int32 vFlSource, Boolean vDEFAUT, String
vCheque, Int32 vTAXABLE, Decimal vNoTaxe, Guid vID) in
F:\Structure\Pr ojets\VS2003
\PME\WS_PME\Com ponents\DB_data set.cs:line 298
at WS_PME.WSPME.Up dateExpense(Str ing vClientID,
Decimal vTotal, Decimal vTPS, Decimal vTVQ, Decimal
vGtotal, DateTime vDateFac, DateTime vDatePay, String
vDescription, Int32 vFlType, Int32 vFlStatus, Int32
vFlCategory, Int32 vFlSource, Boolean vDEFAUT, String
vCHEQUE, Int32 vTAXABLE, Decimal vNoTaxe, Guid vID) in
F:\Structure\Pr ojets\VS2003\PM E\WS_PME\PME.as mx.cs:line 99
--- End of inner exception stack trace ---

Nov 15 '05 #2
"Carl" <ca**@cb-cinc.com> wrote in
news:14******** *************** ******@phx.gbl:
Can you tell me what is wrong with this syntax ?

string select = "UPDATE [PME].[dbo].[Expense] " +
"([ID],[ClientID],[Total],[TPS],[TVQ],[Gtotal],[DateFAC],
[DatePAY],[Description],[fl_type],[fl_status],
[fl_category],[fl_source],[defaut], [Cheque],
[fl_taxable], [notaxe], [id]) " +
" VALUES
(@id,@clientid, @total,@tps,@tv q,@gtotal,@date fac,@datepay,
@description,@f ltype,@flstatus ,@flcategory,@f lsource,@defa
ut,@cheque,@flt axable,@notaxe, @id) " +
" WHERE id = @id";


Carl,

Are you trying to do an UPDATE or INSERT? The command you've written
appears to be a strange combination of both. Is this command being
sent to an SQL server, or some other kind of database?
Chris.
-------------
C.R. Timmons Consulting, Inc.
http://www.crtimmonsinc.com/
Nov 15 '05 #3
Hello,

You are using wrong SQL syntax. I assume that this is an update, although
you've mixed the UPDATE and INSERT syntax.

It should be:
UPDATE yourTable
SET
column1 = 'value1',
column2 = 'value2'
WHERE
id = @id

column1 and column2 are examples of column names, you should substitute this
to your column names (i was lazy writing...)

Hope this helps

--
Regards,
Kristofer Gafvert
http://www.ilopia.com - FAQ & Tutorials for Windows Server 2003, and SQL
Server 2000
Reply to newsgroup only. Remove NEWS if you must reply by email, but please
do not.
"Carl" <ca**@cb-cinc.com> wrote in message
news:14******** *************** ******@phx.gbl. ..
Can you tell me what is wrong with this syntax ?
string select = "UPDATE [PME].[dbo].[Expense] " +
"([ID],[ClientID],[Total],[TPS],[TVQ],[Gtotal],[DateFAC],
[DatePAY],[Description],[fl_type],[fl_status],
[fl_category],[fl_source],[defaut], [Cheque],
[fl_taxable], [notaxe], [id]) " +
" VALUES
(@id,@clientid, @total,@tps,@tv q,@gtotal,@date fac,@datepay,
@description,@f ltype,@flstatus ,@flcategory,@f lsource,@defa
ut,@cheque,@flt axable,@notaxe, @id) " +
" WHERE id = @id";

I receive the following error,

Additional information:
System.Web.Serv ices.Protocols. SoapException: Server was
unable to process request. --->
System.Data.Sql Client.SqlExcep tion: Line 1: Incorrect
syntax near '('.
at System.Data.Sql Client.SqlComma nd.ExecuteReade r
(CommandBehavio r cmdBehavior, RunBehavior runBehavior,
Boolean returnStream)
at System.Data.Sql Client.SqlComma nd.ExecuteNonQu ery()
at WS_PME.DB.SqlGe nericExecute(St ring sqlquery, String
tablename, String ConfigConnectio nKey, String fonction,
Object[,] aParameter) in F:\Structure\Pr ojets\VS2003
\PME\WS_PME\Com ponents\DB_data set.cs:line 181
at WS_PME.DB.Updat e_Expense(Strin g vClientID, Decimal
vTotal, Decimal vTPS, Decimal vTVQ, Decimal vGtotal,
DateTime vDateFac, DateTime vDatePay, String
vDescription, Int32 vFlType, Int32 vFlStatus, Int32
vFlCategory, Int32 vFlSource, Boolean vDEFAUT, String
vCheque, Int32 vTAXABLE, Decimal vNoTaxe, Guid vID) in
F:\Structure\Pr ojets\VS2003
\PME\WS_PME\Com ponents\DB_data set.cs:line 298
at WS_PME.WSPME.Up dateExpense(Str ing vClientID,
Decimal vTotal, Decimal vTPS, Decimal vTVQ, Decimal
vGtotal, DateTime vDateFac, DateTime vDatePay, String
vDescription, Int32 vFlType, Int32 vFlStatus, Int32
vFlCategory, Int32 vFlSource, Boolean vDEFAUT, String
vCHEQUE, Int32 vTAXABLE, Decimal vNoTaxe, Guid vID) in
F:\Structure\Pr ojets\VS2003\PM E\WS_PME\PME.as mx.cs:line 99
--- End of inner exception stack trace ---

Nov 15 '05 #4
The issue as been fixes using the following syntax,

string select = "UPDATE Expense " +
"SET ID = @id,ClientID = clientid,Total = @total,TPS =
@tps,TVQ = @tvq,Gtotal = @gtotal,DateFAC = @datefac," +
"DatePAY = @datepay,Descri ption = @description,fl _type =
@fltype,fl_stat us = @flstatus,fl_ca tegory = @flcategory,"
+
"fl_source = @flsource,defau t = @defaut,Cheque = @cheque,
fl_taxable = @fltaxable,nota xe = @notaxe " +
"WHERE id = @id";

Thanks for all the answers...

Carl,
Nov 15 '05 #5

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

Similar topics

1
14180
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) as Declare @sid int, @fad_a2 int,
1
2124
by: Zoury | last post by:
Hi there! :O) I trying to use a COM DLL (made in VB 6.0) from C#... and it hasn't been working well for me this far.. :O/ I did a sample in VB 6.0 that used the DLL and it works great.. so now I'm trying to do the exact same thing from C#... But I get the following error when I call a function : <error description>
1
11237
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'." Explaining you the scene is the following Stored Proc.
1
2343
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 assignment of "SELECT T..." to the variable query, the last line produces the error: Line 1: Incorrect syntax near '<'. Many thanks in advance for any explanation - the problem is tearing my hair out!! Iain
3
28888
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). There are 3 possibilities in the hra_data table that will cause the loctable to be updated with the calculated value. After playing with it, I thought it was in the correct format but I keep getting an "Incorrect syntax..." error. Any guidence would be...
0
8304
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 records there is an error "Incorrect syntax near '-'. Must declare the scalar variable "@UserName". I worked out in design view,code is automatically generated.Iam not able fix the error. Iam working with Visual Web Developer-2005 Express Edition
10
3408
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 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 the keyword 'where'. Source Error:
1
6245
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. Exception Details: System.Data.SqlClient.SqlException: Incorrect syntax near the keyword 'user'. Source Error: Line 35: MyAdapter1 = new SqlDataAdapter(MyCommand1); Line 36: MyDataSet1 = new DataSet(); Line 37: ...
1
4455
by: Omendra | last post by:
Hi, I am using SQL Server 2005 and i am using Stored Procedure something like :- I am getting error:- Msg 170, Level 15, State 1, Line 18: Incorrect syntax near 'MAX'. DECLARE @jid AS VARCHAR(20), @DBName As VARCHAR(50), @Query AS VARCHAR(MAX)
0
8427
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8330
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8850
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8523
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8626
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6178
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4334
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1737
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.