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

Insert statement error

Hello all,

I have the following problem that I can't seem to solve.

I have a database with 6 different tables. when I update the tables I have
no problems expect with 1 table.
I get a "the instruction Insert contains a syntax error" (I translated this
to english cause I get the error message in dutch).
Using the debugger I can only find the following info
" cannot view the index property " (this not translated).

Most of my other tables have the same layout but they don't give me any
problems. I would like to know how I can find out more on this error.

Extra info:
I use Access database (mdb file)
- I use OleDbcommand, OleDbBuilder and the OleDbAdapter.
The table has no primary key but is linked to another table that has a
primary key.

I hope someone can give me some background info on insert commands and
errors related to these commands.

Bardo
Nov 16 '05 #1
4 1310
get the OleDbcommand.CommandText variable contents just before you try and
insert it. Then try and run the query directly in Access. Access will give
you more help on what's wrong. I do this in SQL Analyzer all the time to
fix my statements.

Chris
"bardo" <ba***@discussions.microsoft.com> wrote in message
news:9F**********************************@microsof t.com...
Hello all,

I have the following problem that I can't seem to solve.

I have a database with 6 different tables. when I update the tables I have
no problems expect with 1 table.
I get a "the instruction Insert contains a syntax error" (I translated
this
to english cause I get the error message in dutch).
Using the debugger I can only find the following info
" cannot view the index property " (this not translated).

Most of my other tables have the same layout but they don't give me any
problems. I would like to know how I can find out more on this error.

Extra info:
I use Access database (mdb file)
- I use OleDbcommand, OleDbBuilder and the OleDbAdapter.
The table has no primary key but is linked to another table that has a
primary key.

I hope someone can give me some background info on insert commands and
errors related to these commands.

Bardo

Nov 16 '05 #2
Bardo,

If the table has no primary key, then when updating, it is probably
doing a comparison on every field in the table to determine which record is
being updated. This can lead to some very large queries being generated for
your table. I would recommend taking a look at the update and delete
commands for the table, and possibly adding a primary key for that table,
and see if it works.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"bardo" <ba***@discussions.microsoft.com> wrote in message
news:9F**********************************@microsof t.com...
Hello all,

I have the following problem that I can't seem to solve.

I have a database with 6 different tables. when I update the tables I have
no problems expect with 1 table.
I get a "the instruction Insert contains a syntax error" (I translated
this
to english cause I get the error message in dutch).
Using the debugger I can only find the following info
" cannot view the index property " (this not translated).

Most of my other tables have the same layout but they don't give me any
problems. I would like to know how I can find out more on this error.

Extra info:
I use Access database (mdb file)
- I use OleDbcommand, OleDbBuilder and the OleDbAdapter.
The table has no primary key but is linked to another table that has a
primary key.

I hope someone can give me some background info on insert commands and
errors related to these commands.

Bardo

Nov 16 '05 #3
Maybe your sql string contains a string to insert to the table with signs
that Access thinks it is part of the command such as "."
If you have such a sign put ' before and after.
"cannot view the index property" is ok. The debugger says it can't show you
a collection. If this collection count is more than zero, then you can view
some items of it by giving a key or an index in the debugger like
"collection[0]".

"bardo" wrote:
Hello all,

I have the following problem that I can't seem to solve.

I have a database with 6 different tables. when I update the tables I have
no problems expect with 1 table.
I get a "the instruction Insert contains a syntax error" (I translated this
to english cause I get the error message in dutch).
Using the debugger I can only find the following info
" cannot view the index property " (this not translated).

Most of my other tables have the same layout but they don't give me any
problems. I would like to know how I can find out more on this error.

Extra info:
I use Access database (mdb file)
- I use OleDbcommand, OleDbBuilder and the OleDbAdapter.
The table has no primary key but is linked to another table that has a
primary key.

I hope someone can give me some background info on insert commands and
errors related to these commands.

Bardo

Nov 16 '05 #4
Chris , Nicholas Paldino, Amiram Korach

I solved the problem. One of the columns was named "From" this column gave a
error. Because its a reserved word in the access database structure.
I want to thank you three for the input.

Bardo
Nov 16 '05 #5

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

Similar topics

16
by: Philip Boonzaaier | last post by:
I want to be able to generate SQL statements that will go through a list of data, effectively row by row, enquire on the database if this exists in the selected table- If it exists, then the colums...
6
by: harborboy76 | last post by:
Hi, I am trying to insert a large number of rows into a table inside a SPL. But every time, I run the SPL, the table is locked because of the INSERT. When I tried to issue a COMMIT, right after...
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...
17
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...
6
by: rn5a | last post by:
During registration, users are supposed to enter the following details: First Name, Last Name, EMail, UserName, Password, Confirm Password, Address, City, State, Country, Zip & Phone Number. I am...
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: 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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
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
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...

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.