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

syntax error in insert into statement.

1
I am using ms access 2010 database for my vb.net application. when I run the insert into statement it gives me erro in OleDb exeption was unhandled syntax error in INSERT INTO statement. when I run the query in SQL view in ms access it shows the error in

Expand|Select|Wrap|Line Numbers
  1. "Insert into Enter_Attendence(Course,Subject,Month,Date,Year,Semester,Day/Parttime,Nameofstudent) values('"
  2.  
  3. 'this is my insert into statement.
  4.  
  5.  Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
  6.  
  7.         cmd = New OleDbCommand("Insert into Enter_Attendence(Course,Subject,Month,Date,Year,Semester,Day/Parttime,Nameofstudent) values('" & ComboBox1.SelectedItem & "','" & ComboBox5.SelectedItem & "','" & ComboBox6.SelectedItem & "',#" & ComboBox7.SelectedItem & "#,'" & ComboBox2.SelectedItem & "','" & ComboBox3.SelectedItem & "','" & ComboBox4.SelectedItem & "','" & CheckedListBox1.CanSelect & "')", con)
  8.  
  9.         cmd.ExecuteNonQuery()
please anyone help me I can't find what is the error/errors.
Oct 7 '12 #1
1 1630
Rabbit
12,516 Expert Mod 8TB
Please use code tags when posting code.

When you use non-standard characters in the name of a field, you need to demarcate them as such with square brackets. If you have anything other than letters, numbers, and underscores, then it's a nonstandard character.

Therefore, when referring to Day/Parttime, you need to use [Day/Parttime].

Also, if you use reserved key words, such as Year or Month or Left, you may also need to demarcate them.
Oct 7 '12 #2

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

Similar topics

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...
2
by: Tim::.. | last post by:
Can someone please tell me why I keep getting the following error from the code below! Error: INSERT statement conflicted with COLUMN FOREIGN KEY constraint...
3
by: jinhy82 | last post by:
Hi! I am currently creating a Registration form which contained: UserID Password, FirstName and LastName. These details would be inserted into Ms Access when I click submi button. But I...
3
by: Nathan Sokalski | last post by:
When trying to submit data to an Access database using ASP.NET I recieve the following error: System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(Int32 hr) +41...
5
by: amitbadgi | last post by:
Hi guys, I am getting the following error in teh insert statement , I am converting this asp application to asp.net, here is teh error, Exception Details:...
2
by: Geoffrey KRETZ | last post by:
Hello, I'm wondering if the following behaviour is the correct one for PostGreSQL (7.4 on UNIX). I've a table temp_tab with 5 fields (f1,f2,f3,...),and I'm a launching the following request :...
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...
9
by: Ed Pisa | last post by:
Hello, I have been working with this problem now for several days. I can delete and Update my data but I can not get it to insert a new record. I receive the syntax error insert into. I am not...
0
by: Ed Pisa | last post by:
Hello, I have been working with this problem now for several days. I can delete and Update my data but I can not get it to insert a new record. I receive the syntax error insert into. I am not...
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: 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:
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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...

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.