473,326 Members | 2,111 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,326 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 1539
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())"...
4
by: Neil | last post by:
Having trouble with inserting a record into a table. It's a list of names. But, for some reason, it won't take a particular name. When a user tries to enter a name into the table, the system hangs...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.