473,403 Members | 2,354 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,403 software developers and data experts.

I got Syntax Error on my Update command.. Please do help me for I need to finish this

1
Expand|Select|Wrap|Line Numbers
  1. Imports System.Data
  2.  
  3. Imports System.Data.OleDb
  4.  
  5.  
  6. Public Class ControlFile
  7.     Dim cnnOLEDB As New OleDbConnection
  8.  
  9.     Dim cmdOLEDB As New OleDbCommand
  10.  
  11.     Dim cmdInsert As New OleDbCommand
  12.  
  13.     Dim cmdUpdate As New OleDbCommand
  14.  
  15.     Dim cmdRemove As New OleDbCommand
  16.  
  17.     Dim strConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source= E:\VB Programs\AIS.accdb"
  18.  
  19. Private Sub ControlFile_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  20.  
  21.         cnnOLEDB.ConnectionString = strConnectionString
  22.  
  23.         cnnOLEDB.Open()
  24.  
  25. End Sub
  26.  
  27.  
  28. Private Sub cmdEdit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdEdit.Click
  29.  
  30. If OrganizationTextBox.Text <> "" And CalendarYearTextBox.Text <> "" Then
  31.  
  32.  
  33. cmdUpdate.CommandText = "UPDATE ControlFile SET " & _
  34. "Organization = '" & OrganizationTextBox.Text & "', " & _
  35. "CalendarYear = '" & CalendarYearTextBox.Text & "', " & _
  36. "EarningsControl = '" & EarningsControlTextBox.Text & "', " & _
  37. "EarningsAccount = '" & EarningsAccountTextBox.Text & "', " & _
  38. "RetainedControl = '" & RetainedControlTextBox.Text & "', " & _
  39. "RetainedAccount = '" & RetainedAccountTextBox.Text & "', " & _
  40. "DebitCredit = '" & DebitCreditTextBox.Text & "', " & _
  41. "CurrentPeriod = '" & CurrentPeriodTextBox.Text & "', " & _
  42. "WHERE Organization = '" & OrganizationTextBox.Text & "'"
Oct 11 '13 #1
1 1161
Rabbit
12,516 Expert Mod 8TB
Please use code tags when posting code or formatted data.

It would help to have the full error message, but the most likely cause is that you have an extra comma in your SQL string before the where clause.
Oct 11 '13 #2

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

Similar topics

1
by: amitbadgi | last post by:
HI i am getting the foll error while conv an asp application to asp.net Exception Details: System.Runtime.InteropServices.COMException: Syntax error in UPDATE statement. Source Error: Line...
3
by: Jerry | last post by:
Well, here is some weirdness. First, I noticed that I have 2 Set keywords (silly me). so I removed the 2nd "Set" but still got a syntax error. Then I removed the Where clause, and now it works...
8
by: Kevin Murphy | last post by:
Using PG 7.4.3 on Mac OS X 10.2.8, the following "insert into ... select ..." statement completed and then announced a syntax error, which seems bizarre. (Don't be confused by the fact that the...
2
by: technocraze | last post by:
Hi guys, I have encountered this error when updating the values to the MS Acess table. Error : Update on linked table failed. ODBC sql server error Timeout expired. MS Acess is my front end and...
2
by: explode | last post by:
I made nova oledbdataadapter select update insert and delete command and connection veza. dataset is Studenti1data, I made it by the new data source wizard,and made datagridview and bindingsource...
3
by: Ibuprofen800mg | last post by:
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" strSQL="UPDATE , , , , , , ,...
3
by: ollii | last post by:
im creating a iterrative server and i get this error error: syntax error before numeric constant and this errors occurs near this line: int listen(sock,5); need help
4
by: cluce | last post by:
I am getting a syntax error but I cant seem to spot it. need help with this. Its when I click the save button that fires my SQL UPDATE query. thansk in advance 'module level declarations Dim...
0
by: ewokspy | last post by:
When I perform an Update using a dataadapter I am getting an error stating there is a syntax error in UPDATE command. Here is the Update Command that is in the adapter: UPDATE PAPrintJobs SET...
1
by: vasanth chandrasekaran | last post by:
The error is :Syntax error in INSERT INTO statement. This is my code: try { DataSet ds1; OleDbConnection ConnSql; OleDbConnection...
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?
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...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...

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.