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

I am using Access2010 and VB2008 Express for my application. I get a Syntax error in

2
Expand|Select|Wrap|Line Numbers
  1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  2.         Dim Cmd As New OleDbCommand
  3.         Dim SQL As String
  4.         Dim DbCmd As New OleDbCommand
  5.         Dim conn As New OleDbConnection()
  6.  
  7.  
  8.  
  9.         conn.ConnectionString = "Provider=Microsoft.Ace.OLEDB.12.0;Data Source=C:\Documents and Settings\Owner\My Documents\Results2012.accdb"
  10.         conn.Open()
  11.         SQL = "INSERT INTO Game_Summary(Week,Opponent,Game1,Game2,Game3,OP Game1,OP Game2,OP Game3,Series,OP Series,Wins,OP Wins)" & _
  12.         "VALUES('?','?','?','?','?','?','?','?','?','?','?','?');"
  13.         Cmd = New OleDbCommand(SQL, conn)
  14.         Cmd.Parameters.AddWithValue("Week", ListBox2.Text)
  15.         Cmd.Parameters.AddWithValue("Opponent", TextBox89.Text)
  16.         Cmd.Parameters.AddWithValue("Game1", TextBox26.Text)
  17.         Cmd.Parameters.AddWithValue("Game2", TextBox27.Text)
  18.         Cmd.Parameters.AddWithValue("Game3", TextBox28.Text)
  19.         Cmd.Parameters.AddWithValue("OP Game1", TextBox55.Text)
  20.         Cmd.Parameters.AddWithValue("OP Game2", TextBox67.Text)
  21.         Cmd.Parameters.AddWithValue("OP Game3", TextBox68.Text)
  22.         Cmd.Parameters.AddWithValue("Series", TextBox29.Text)
  23.         Cmd.Parameters.AddWithValue("Op Series", TextBox83.Text)
  24.         Cmd.Parameters.AddWithValue("Wins", TextBox63.Text)
  25.         Cmd.Parameters.AddWithValue("Op Wins", TextBox71.Text)
  26.  
  27.  
  28.  
  29.         DbCmd = New OleDbCommand(SQL, conn)
  30.         DbCmd.ExecuteNonQuery()
  31.         conn.Close()
Oct 10 '12 #1
2 1129
Rabbit
12,516 Expert Mod 8TB
Please use code tags when posting code.

I have no idea what your question is.

But I'll take a stab at the solution and it's because you use nonstandard characters in your field names (in this case, spaces). When you do that, you must demarcate it as a field using square brackets.
Expand|Select|Wrap|Line Numbers
  1. [OP Game1]
You should also not give your parameters the same name as your fields, that will just cause ambiguity.
Oct 10 '12 #2
arseno
2
Thanks,
I understand completely
Oct 10 '12 #3

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

Similar topics

1
by: Steve | last post by:
I just spent waaaaaaaaaaaayy too much time trying to track down an error that was incorrectly reported just now, and I would like to see if someone can explain to me why it was reported that way. ...
7
by: kosta | last post by:
hello! one of my forms communicates with a database, and is supposed to add a row to a table using an Insert statement... however, I get a 'oledb - syntax error' exception... I have double...
5
by: Kim Nørby Andersen | last post by:
Hello there I am lost. i receive the output in the bottom, from a site that runs excellently on our development server, but dies on the customer. We have had a first version running at the...
5
by: r.nikhilk | last post by:
Hi, Currently, we are porting C++ applications from 32 bit to 64 bit on AIX platform. (The current version of AIX is 5.3 and xlC verison is 8.0). We are able to compile the applications by...
3
by: Manuel | last post by:
I'm trying to compile glut 3.7.6 (dowbloaded from official site)using devc++. So I've imported the glut32.dsp into devc++, included manually some headers, and start to compile. It return a very...
4
by: WT | last post by:
Hello, Using VS2005, when I open the global.asax file, the editor underlines in blue all the line with a tooltip saying 'Syntaxe error '. <%@ Application Language="C#"...
4
by: leaf0209 | last post by:
Hi, I am new to this forum and have been troubled by this problem for the past few days. I would appreciate if someone would take a look and help me out. I am using vb express 2005 edition... ...
6
by: Scott Gravenhorst | last post by:
Windows XP SP3 My application is set to open a SaveFile dialog when an exit is requested. When I click the app's close button, the save dialog opens, but when I click to change the folder, the...
5
by: Chris Kennedy | last post by:
Hi all I'm running SQL Server 2005 Express Edition. One database One table called Sites Fields as follows: id (bigint, Identity, Primary Key) SiteName (varchar(50), allows nulls) Generation...
14
by: Mike Copeland | last post by:
I'm getting a syntax error on the "typedef" code line here. Any thoughts on why? TIA struct CSTYPE { // City/State Record string csKey; ...
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: 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
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
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.