By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,544 Members | 2,002 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,544 IT Pros & Developers. It's quick & easy.

INSERT statement contains fewer items than the insert list

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
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

P: n/a
"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 discussion thread is closed

Replies have been disabled for this discussion.