473,498 Members | 1,793 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

INSERT statement contains fewer items than the insert list

The block of code below shows how I am inserting field values into my
dbase table:

strSQLStatement = "INSERT INTO tblArticles
(handid,ArticleDate,sport,articleheader, fpick,articleText) "_
& "SELECT '" & handid & "' As handid, '" _
& ArticleDate & "' As ArticleDate, '" _
& sport & " As sport, " _
& articleheader & "' As articleheader, '" _
& fpick & "' As fpick, '" _
& articleText & "' As articleText;"

Conn.Execute(strSQLStatement)

...but I am getting an "Insert statement contains fewer items than the
insert list" error , when in fact I am not (both 6 field names).

????
Muench

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #1
3 3824
On Tue, 30 Sep 2003 13:06:31 -0700, J. Muenchbourg <jo*****@canada.com> wrote:
The block of code below shows how I am inserting field values into my
dbase table:

strSQLStatement = "INSERT INTO tblArticles
(handid,ArticleDate,sport,articleheader, fpick,articleText) "_
& "SELECT '" & handid & "' As handid, '" _
& ArticleDate & "' As ArticleDate, '" _
& sport & " As sport, " _
& articleheader & "' As articleheader, '" _
& fpick & "' As fpick, '" _
& articleText & "' As articleText;"

Conn.Execute(strSQLStatement)

..but I am getting an "Insert statement contains fewer items than the
insert list" error , when in fact I am not (both 6 field names).

????
Muench

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Try a
Response.Write (strSQLStatement)
to see if perhaps the quotes or commas are getting misplaced...

Jul 19 '05 #2
Uh, did you mean

strSQLStatement = "INSERT tblArticles (handid, ...) VALUES('" & handid & "',
....)"

(I've never seen As used for aliases in an *insert* statement; not saying
that it wouldn't work, but it looks weird, and bloats your code
unnecessarily.)

Also, a good debugging technique, as always, is

Response.Write (strSQLStatement)

In this case, you are very likely to spot the problem without having to post
a message at all. And when you do have to post a message, you give us more
useful information than an unpopulated SQL statement...



"J. Muenchbourg" <jo*****@canada.com> wrote in message
news:uM**************@TK2MSFTNGP12.phx.gbl...
The block of code below shows how I am inserting field values into my
dbase table:

strSQLStatement = "INSERT INTO tblArticles
(handid,ArticleDate,sport,articleheader, fpick,articleText) "_
& "SELECT '" & handid & "' As handid, '" _
& ArticleDate & "' As ArticleDate, '" _
& sport & " As sport, " _
& articleheader & "' As articleheader, '" _
& fpick & "' As fpick, '" _
& articleText & "' As articleText;"

Conn.Execute(strSQLStatement)

..but I am getting an "Insert statement contains fewer items than the
insert list" error , when in fact I am not (both 6 field names).

????
Muench

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Jul 19 '05 #3
"J. Muenchbourg" <jo*****@canada.com> wrote in message
news:uM**************@TK2MSFTNGP12.phx.gbl...
The block of code below shows how I am inserting field values into my
dbase table:

strSQLStatement = "INSERT INTO tblArticles
(handid,ArticleDate,sport,articleheader, fpick,articleText) "_
& "SELECT '" & handid & "' As handid, '" _
& ArticleDate & "' As ArticleDate, '" _
& sport & " As sport, " _
& articleheader & "' As articleheader, '" _
& fpick & "' As fpick, '" _
& articleText & "' As articleText;"

Conn.Execute(strSQLStatement)

..but I am getting an "Insert statement contains fewer items than the
insert list" error , when in fact I am not (both 6 field names).

????
Muench

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Try this:

strSQLStatement = "INSERT INTO tblArticles (handid,ArticleDate,sport,articleheader, fpick,articleText) "_
& "VALUES (" & handid & ", " _
& ArticleDate & ", " _
& sport & ", " _
& articleheader & ", " _
& fpick & ", " _
& articleText & ")"

Jul 19 '05 #4

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

Similar topics

4
6911
by: soni29 | last post by:
hi, i have a small question regarding sql, there are two tables that i need to work with on this, one has fields like: Table1: (id, name, street, city, zip, phone, fax, etc...) about 20 more...
6
4926
by: Arne Claus | last post by:
Hi If've just read, that remove() on a list does not actually remove the elements, but places them at the end of the list (according to TC++STL by Josuttis). It also says, that remove returns a...
3
22062
by: Andrew Clark | last post by:
*** post for FREE via your newsreader at post.newsfeed.com *** it's been a while since i have poseted to this newsgroup, but for a long time i was not programming at all. but now that i am out of...
4
1314
by: bardo | last post by:
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...
1
7641
by: ven | last post by:
hello i`m makin a asp.net service with database connection where i have an insert with decimal value, when i run my function i get this error : There are fewer columns in the INSERT statement...
2
3169
by: Geoffrey KRETZ | last post by:
Hello, I'm wondering if the following behaviour is the correct one for PostGreSQL (7.4 on UNIX). I've a table temp_tab with 5 fields (f1,f2,f3,...),and I'm a launching the following request :...
5
2887
by: Stuart | last post by:
Hi everyone, I have this app that needs to insert about 400,000+ items into a sorted list, and I am currently using a simple insert something like this: int index = list.BinarySearch(t); if...
6
2151
by: Heiko Wundram | last post by:
Hi all! The following PEP tries to make the case for a slight unification of for statement and list comprehension syntax. Comments appreciated, including on the sample implementation. ===...
3
13852
by: questionit | last post by:
Hi How do i write multiple values in a single column, using INSERT INTO I have a listbox and i want all the selected values from that listbox inserted into a table column INSERT INTO...
0
7125
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
7167
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,...
1
6890
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
5464
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4915
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...
0
4593
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...
0
1423
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
657
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
292
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.