473,395 Members | 2,151 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.

problem with insert into

I have this line of code : string insert = @"INSERT INTO Reservation
(StudentName, Day, Hour, Station) Values('julien', '8 july 20004', '12.00
pm', 'station 1')";

but when I run the web form, I have this error

Exception Details: System.Data.OleDb.OleDbException: Syntax error in INSERT
INTO statement.

Source Error:

Line 106: commandReserv = new OleDbCommand(insert,connectReserv);
Line 107: connectReserv.Open();
Line 108: commandReserv.ExecuteNonQuery();
Line 109: connectReserv.Close();
Line 110: connectReserv.Dispose();
Can you help me because I do not find the mistake, Thanks for your help.
Nov 18 '05 #1
5 1058
20004?

Eliyahu

"belange" <ju*******@REMOVEME.caramail.com> wrote in message
news:uh**************@TK2MSFTNGP12.phx.gbl...
I have this line of code : string insert = @"INSERT INTO Reservation
(StudentName, Day, Hour, Station) Values('julien', '8 july 20004', '12.00
pm', 'station 1')";

but when I run the web form, I have this error

Exception Details: System.Data.OleDb.OleDbException: Syntax error in INSERT INTO statement.

Source Error:

Line 106: commandReserv = new OleDbCommand(insert,connectReserv);
Line 107: connectReserv.Open();
Line 108: commandReserv.ExecuteNonQuery();
Line 109: connectReserv.Close();
Line 110: connectReserv.Dispose();
Can you help me because I do not find the mistake, Thanks for your help.

Nov 18 '05 #2

"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:uC**************@TK2MSFTNGP09.phx.gbl...
20004?

Eliyahu


20004 is just a mistake when I enter the date, it's 2004, I think this is
not my problem
Nov 18 '05 #3
Hard to say for sure. I would suspect that at least some of your column
names ("Day" and "Hour" stick out to me) are reserved words in the database
product you're using. However, I don't know WHAT database product you're
using, so I can't advise you as to how to handle it. Different databases use
different rules. In any Microsoft database, putting [square brackets] around
the column names would do the trick.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"belange" <ju*******@REMOVEME.caramail.com> wrote in message
news:uh**************@TK2MSFTNGP12.phx.gbl...
I have this line of code : string insert = @"INSERT INTO Reservation
(StudentName, Day, Hour, Station) Values('julien', '8 july 20004', '12.00
pm', 'station 1')";

but when I run the web form, I have this error

Exception Details: System.Data.OleDb.OleDbException: Syntax error in INSERT INTO statement.

Source Error:

Line 106: commandReserv = new OleDbCommand(insert,connectReserv);
Line 107: connectReserv.Open();
Line 108: commandReserv.ExecuteNonQuery();
Line 109: connectReserv.Close();
Line 110: connectReserv.Dispose();
Can you help me because I do not find the mistake, Thanks for your help.

Nov 18 '05 #4

"Kevin Spencer" <ks******@takempis.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Hard to say for sure. I would suspect that at least some of your column
names ("Day" and "Hour" stick out to me) are reserved words in the database product you're using. However, I don't know WHAT database product you're
using, so I can't advise you as to how to handle it. Different databases use different rules. In any Microsoft database, putting [square brackets] around the column names would do the trick.

Thanks Kevin for your answer, I use an access database.
Nov 18 '05 #5

put square brackets around your Day and Hour fields

eg.

INSERT INTO Reservation(StudentName, [Day], [Hour], Station) VALUES
('Julien', '8 july 2004', '12pm', 'Station 1');

--
spalding
------------------------------------------------------------------------
Posted via http://www.codecomments.com
------------------------------------------------------------------------

Nov 18 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: newbie_mw | last post by:
Hi, I need urgent help with a novice problem. I would appreciate any advice, suggestions... Thanks a lot in advance! Here it is: I created a sign-up sheet (reg.html) where people fill in their...
5
by: Juho Saarikko | last post by:
I made a Python script which takes Usenet message bodies from a database, decodes uuencoded contents and inserts them as Large Object into a PostGreSQL database. However, it appears that the to...
0
by: Dean A. Hoover | last post by:
I am doing a contract job for a client with some existing messy data. I am trying to find a solution to a problem of many-to-many mappings between two tables in a database. See below for my...
2
by: Gunnar Vøyenli | last post by:
Hi Some days ago I posted a problem with a query. Thaks to Dave and John, I got a little closer to a solution. Their suggestion was a solution to my problem as I stated it, but the real problem...
3
by: Myron | last post by:
I'm trying to create a query that will tell me which requests took longer than 10 days to move one from particular state to another state. The query I've created returns the correct requests, but...
9
by: Mike R | last post by:
Hi, I cant figure out how to do this.... for example: Select name from mytab order by col1 could return Mike
4
by: Bradley Burton | last post by:
I'm using Allen Brown's code for audit logging (http://allenbrowne.com/AppAudit.html), but I'm having a problem. My aud table doesn't populate with the tracking info at all. I think it might be a...
1
by: Net Virtual Mailing Lists | last post by:
Hello, I have 3 tables which are joined that I need to create a summation for and I just cannot get this to work. Here's an example: CREATE table1 ( id1 INTEGER, title1 VARCHAR
0
by: ZoeNet | last post by:
Hi all, The table structures are below. The table category_cat is built on the adjacency model (where the parent and child entries are both stored in the same table). For my problem, I've...
2
by: AlexanderDeLarge | last post by:
Hi! I got a problem that's driving me crazy and I'm desperately in need of help. I'll explain my scenario: I'm doing a database driven site for a band, I got these tables for their discography...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
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
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.