473,651 Members | 2,987 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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, MaximumKilomete rs,
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 "Syntaxfehl er 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 5615
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, MaximumKilomete rs,
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 "Syntaxfehl er 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
61564
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 same structure as follows Keycolumns ========== Material
1
1555
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, Model, DateOfBuy, MaximumKilometers, KilometersUsed, Comments, RunnerID) VALUES ('Whatever', 'Nike', '12.04.2004', 400, 0, 'no comments :-)', 1)
7
6657
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 checked, and the insert works fine (tried to use it from access)... im using visual C# express 2k5... what could be wrong? thanks!
3
2021
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; string comlnB = TextBox2.Text; string sqlstatment = "INSERT INTO TABLENAME VALUES(" +"'"+colmnA+"'" + "," + "'" + colmnB + "'" + ")";
2
1674
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 error code. This system is using OLEDB to connect to an Access database. I've tried applying the insert statement directly to the Access database and it works fine.
3
1569
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 Dim connectionString As String = AppSettings("connectionString")
5
2607
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 namespace="System.Data" %> <%@ import namespace="System.Data.SqlClient" %> <script language="c#" runat="server"> public void Page_Load(object sender, EventArgs e) {
22
4313
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 Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\DB.mdf....
8
1520
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())" Dim insCmd As New OleDbCommand(insStr, dbConContacts)
0
8361
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8278
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8807
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8701
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8584
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6158
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5615
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4144
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
1912
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.