473,699 Members | 2,135 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

1 New Member
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 1168
Rabbit
12,516 Recognized Expert Moderator MVP
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
3089
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 112: MM_editCmd.ActiveConnection = MM_editConnection Line 113: MM_editCmd.CommandText = MM_editQuery Line 114: MM_editCmd.Execute
3
3121
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 perfectly. Is this correct? Or am I just getting lucky? I'm not completely clear on the fundamentals here. I update the table in my dataset, then I update the table on the server through the dataAdapter. I think I have a handle on the...
8
2217
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 two tables referred to (public.identifiers and original.identifiers) have slightly different column names.) egenome_dev=# \!cat /Users/murphy/cvs/egora/sql/data_port/port_identifiers.sql INSERT INTO public.identifiers (element_id, name, source,...
2
4811
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 sql server is my backend server. This error occured whenever i step through and when it reaches rs.update it jux hangs down there and thereafter it shwn the aforementioned error. I am using the RecordSet properties to add the values. Can I use...
2
2928
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 draging Table1 to Form2. The select command works fine, but when I change the data and call update command I get a syntax error: System.Data.OleDb.OleDbException was unhandled ErrorCode=-2147217900 Message="Syntax error in UPDATE statement."...
3
8607
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
17087
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
3228
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 rsNames As ADODB.Recordset Dim cnDb As ADODB.Connection Dim strConnection As String Dim blnAddMode As Boolean
0
1186
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 (Threaded = ?, PickedUp = ? ) WHERE ( Id = ? AND Owner = ? AND SubmittedDate = ? AND SubmittedTime = ? ); Can anyone spot the error? I'm pretty sure I have verified all column names match, the table name is correct and that the 3 rows I'm updating...
1
1407
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 ConnExcel; OleDbDataAdapter da1; OleDbDataAdapter da2; string ConnStringSql = "Provider=sqloledb;Data Source = cst;Initial Catalog = Testido;User ID=sa;Pwd=connect#963;";
0
8706
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
8630
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
9199
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
8944
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
8899
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
6550
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
4391
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3075
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2364
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.