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

ASP.NET C# Code Behind - SQL Update Command

I've tried so many ways now, I couldn't even list them. For the life of me, I cannot seem to update my database, I either get "error in syntax on update command"

Expand|Select|Wrap|Line Numbers
  1.             strSQL="UPDATE [q1], [q2], [q3], [q4], [q5], [q6], [q7], [q8],"+
  2.                 " [q9], [q10], [q11], [q12], [q13], [q14], [q15],"+
  3.                 " [q16], [q17], [q18], [q19], [q20], [q21], [q23],"+
  4.                 " [q24], [q26], [q28], [q34], [q35], [q38], [q39],"+
  5.                 " [q40], [q42], [q43], [q44], [q45], [q46], [q47],"+
  6.                 " [q48], [q51], [q52], [q53], [q54], [q57], [q58],"+
  7.                 " [q61], [q62], [q63], [q66], [q67], [q70], [q71],"+
  8.                 " [q72], [q73], [q74], [q75], [q84], [q85], [q86],"+
  9.                 " [q87], [q88], [q89], [q90], [q91], [q98], [q99],"+
  10.                 " [q100], [q101],"+" [q102], [q103], [q104], [TCAIMSSite],"+
  11.                 " [DTG_Submit], [LoginID], [TestPhase]"+
  12.                 "  FROM t_EOT_User WHERE RecNum="+RecNum.Text;
Anyone?
Apr 27 '07 #1
3 8591
dbrewerton
115 100+
At first glance, I can tell that you've declared all the fields you want. But I think the problem is with an update clause, the format has to be like this:

update table
set field1 = "value";

Basically, your DB doesn't know what you want it to place into those fields.
Nov 17 '09 #2
dbrewerton
115 100+
Also, the update clause you are using looks like a select statement.
Nov 17 '09 #3
Curtis Rutland
3,256 Expert 2GB
Yes, that is incorrect syntax. A SQL UPDATE statement looks like this:
Expand|Select|Wrap|Line Numbers
  1. UPDATE table_name 
  2. SET field_name = 'some_value', field_name2 = 'some_other_value' 
  3. WHERE some_identifying_field = some_condition
If you are using a SqlDataAdapter and DataSet, you can use the .Update() method on the adapter, assuming that you have provided proper INSERT, UPDATE, and DELETE statements to the adapter.
Nov 18 '09 #4

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

Similar topics

171
by: tshad | last post by:
I am just trying to decide whether to split my code and uses code behind. I did it with one of my pages and found it was quite a bit of trouble. I know that most people (and books and articles)...
1
by: Wernfried Schwenkner | last post by:
In a page I have a button. On the code behind in the click event I wan't to fill a data table of the sql server. Therefor I have place a SqlDataSource on the page in the designer, configured all...
1
by: siaj | last post by:
Helo All, If some one has faced a similar issue.. My datagrid Update command is not getting fired in fact it seems that the no event fires on clicking the update link. Although the cancel and the...
4
by: siaj | last post by:
Hello All, If some one has faced a similar issue.. My datagrid Update command is not getting fired in fact it seems that the no event fires on clicking the update link. Although the cancel and the...
3
by: needin4mation | last post by:
Hi, I was trying to update some 1.1 code with 2005. I ran into problems, so I thought I'd just use notepad to make a minor change to the .cs file. When I run the .aspx file (and refresh), nothing...
2
by: travhale | last post by:
in a new project using .net 2005, c#. getting err message "Update requires a valid UpdateCommand when passed DataRow collection with modified rows." source RDBMS is oracle 8i. I add a new...
2
by: Jason | last post by:
Is there any way to initiate a sqldatasource insert from code in place of the button with commandname=insert or insert? I have a formview with a datasource with an insert command on a button....
0
by: jmacduff | last post by:
Big question: How to enable edit/update commands to work when setting the sqldatasource select command from code behind. Details: I have a GridView using a sqldatasouce with the select and...
15
dbrewerton
by: dbrewerton | last post by:
Ok everyone, when I do this update clause using code behind it gives me a stupid error that says: Line: 6 Char: 62099 Error: Sys.WebForms.PageRequestManagerServerErrorException: Format of the...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: 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
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
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...

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.