473,397 Members | 2,084 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.

Problem with INSERT INTO statement (Access and VB .NET)

Hi experts,

I am working on a university project based on VB .NET. I have a
connection to MS Access, and I want to insert some data into the
database. The sql command

INSERT INTO Shoe (Brand, Model, DateOfBuy, MaximumKilometers,
KilometersUsed, Comments, RunnerID) VALUES ('Whatever', 'Nike',
'12.04.2004', 400, 0, 'no comments :-)', 1)

works fine, but with

INSERT INTO TrainingUnit (RunnerID, Description, AvgHeartrate,
DateAndTime, FeelingID, MethodID, ShoeID, StrainID, Temperature, Time,
TrackID, WeatherID) VALUES (1, 'test', 132, '12.04.2004 17:45:51', 2, 2,
8, 2, 22, '00:00:00', 5, 2)

I get a "Syntaxfehler in der INSERT INTO-Anweisung." (german for "Syntax
error in INSERT INTO-statement.")
As far as I can see, the tables etc are fine.

Does anybody have an idea?

Thanks in advance,
Christian
Nov 12 '05 #1
1 5589
Christian Soltenborn <no*****************@web.de> wrote in message news:<c5************@ID-36219.news.uni-berlin.de>...
Hi experts,

I am working on a university project based on VB .NET. I have a
connection to MS Access, and I want to insert some data into the
database. The sql command

INSERT INTO Shoe (Brand, Model, DateOfBuy, MaximumKilometers,
KilometersUsed, Comments, RunnerID) VALUES ('Whatever', 'Nike',
'12.04.2004', 400, 0, 'no comments :-)', 1)

works fine, but with

INSERT INTO TrainingUnit (RunnerID, Description, AvgHeartrate,
DateAndTime, FeelingID, MethodID, ShoeID, StrainID, Temperature, Time,
TrackID, WeatherID) VALUES (1, 'test', 132, '12.04.2004 17:45:51', 2, 2,
8, 2, 22, '00:00:00', 5, 2)

I get a "Syntaxfehler in der INSERT INTO-Anweisung." (german for "Syntax
error in INSERT INTO-statement.")
As far as I can see, the tables etc are fine.

Does anybody have an idea?

Thanks in advance,
Christian


It's possible that Access is getting confused by its Time() function.
I'd definitely rename that field. I also suggest that you start with
a small test table with one field and add one field at a time when its
SQL command is successful to isolate which field is causing the
problem. Also, does the Shoe table have a nice primary key that is
lacking in TrainingUnit? Your first test with one field should tell
you if this is an issue. The primary key is an issue with SQL Server
and perhaps VB.NET. In spite of the list you provide, Access
sometimes just tries to insert the values in the order they are listed
in the table design. Is the order of fields in Shoe the same as in
the table design? If so, how about for TrainingUnit?

Hope this helps,
James A. Fortune
Nov 12 '05 #2

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

Similar topics

6
by: Karen Middleton | last post by:
In MS Access I can do in one SQL statement a update if exists else a insert. Assuming my source staging table is called - SOURCE and my target table is called - DEST and both of them have the...
1
by: Christian Soltenborn | last post by:
Hi experts, I am working on a university project based on VB .NET. I have a connection to MS Access, and I want to insert some data into the database. The sql command INSERT INTO Shoe (Brand,...
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...
3
by: alexmaster_2004 | last post by:
hi i have made an application using C# that access sql2000. this application is just used to insert data to the database. i use something like this in my code: // string colmnA = TextBox1.Text;...
2
by: Paul Mason | last post by:
Hi folks, The ado.net stream appears to be not working so I'm here. The following function generates the error "Operation must use an updateable query". There is no identifiable or meaningful...
3
by: Shapper | last post by:
Hello, I need to add a new record to an ACCESS database. I get the error: Syntax error in INSERT INTO statement. I have no idea what am I doing wrong. This is my code: ' Set Connection...
5
by: Brad Baker | last post by:
I'm trying to write a simple asp.net page which updates some data in a SQL database. At the top of the page I have the following code: <%@ Page Language="C#" Debug="true" %> <%@ import...
22
by: b_r | last post by:
Hi, I'm trying to make a simple operation (insert into DB) in VB 2005 and SQL Server. The code is as follows: Dim sConnectionString As String = _ "Data...
8
by: John | last post by:
Hi I am using the below code to run a sql on an underlying access table; insStr = "INSERT INTO ( Action, , , Request_Date ) " & _ "VALUES (""Modify Client"", 93, ""Administrator"", Now())"...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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
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.