Article View: borland.public.cppbuilder.database.ado
Article #4637Re: ADO Command Component/SQL Syntax Question
From: Lee Gan
Date: Mon, 22 Oct 2001 16:06
Date: Mon, 22 Oct 2001 16:06
80 lines
3641 bytes
3641 bytes
I guess I now have a better understanding of your problem. In the INSERT INTO statement, you have to make sure the number of fields is the the same as that of the database. Use NULL to skip a field if it is NULLable. If you do not want to specify all the fields, use UPDATE statement instead. Lee Gan "jqpdev" <jqpdev@whowhatwhere.com> wrote in message news:3bd08b78$1_1@dnews... > Thanks for your time and replay Lee. > I tried what you suggested, but it didn't work. > I got an EoleException message that said the "number of query values and > destination fields are not the same". > > "Lee Gan" <leegan@hotmail.com> wrote in message news:3bcb51f8$1_2@dnews... > > Why don't you try > > > > INSERT INTO tbl_Semesters VALUES (:SemesterCategory, :Year, :Active); > > > > It should work. It works on mine anyway. Good luck. > > > > Lee Gan > > > > <jqpdev> wrote in message news:3bc85e2c$1_2@dnews... > > > Hello All, > > > > > > I'm trying to do and SQL Insert with an ADO Command Component. I > checked > > > several times > > > and the SQL statement looks legit. I get an error message that says > there > > is a > > > syntax error with the insert into statement. > > > Here is the SQL statement: > > > --------------------------------------- > > > INSERT INTO tbl_Semesters(SemesterCategory, Year, Active) > > > VALUES(:SemesterCategory, :Year, :Active ); > > > --------------------------------------- > > > > > > I'm currently using Access2000. In my DB I have a table called > > "tbl_Semesters", > > > with the following fields: > > > Semester_ID = AutoInc > > > SemesterCategory = LongInt (Foriegn Key Ref) > > > Year = LongInt > > > Active = Boolean (Access2000 say Yes/No Field Type) > > > > > > All values placed in the parameters are valid... I double checked. > > > I have another command component with a SQL statement similar to the one > > above, > > > but for another table. The only difference is the field names/parameter > > > names/param data types are different. > > > > > > Am I missing something with the SQL syntax, the ADO Command Component, > or > > proper > > > use of the ADO Command Component? > > > > > > Just in case you wanted to know I'm using > > > - BCB v5 Enterprise with Update Pack1 > > > - MDAC v2.5 > > > - Access2000 > > > - Win2K Server > > > - P3-500 > > > - 512Meg of RAM > > > - 6 Gig partition with 3.13gig free > > > - 1.5gig swap file > > > - Hard drive scanned for errors and there were none > > > - Hard drive was defraged > > > - Only the bare essentials for development and use have been installed > on > > the > > > partition. > > > - NO 3rd party controls/experts/IDE adds. > > > > > > > > > > > >
Technical Details
Message-ID:
<3bd44422$1_2@dnews>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!feedme.news.mediaways.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnewsReferences:
<3bc85e2c$1_2@dnews> <3bcb51f8$1_2@dnews> <3bd08b78$1_1@dnews>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10698b,a71d499ca9f0e9ae X-Google-Attributes: gid10698b,public X-Google-ArrivalTime: 2001-10-22 09:10:22 PST From: "Lee Gan" <leegan@hotmail.com> Newsgroups: borland.public.cppbuilder.database.ado References: <3bc85e2c$1_2@dnews> <3bcb51f8$1_2@dnews> <3bd08b78$1_1@dnews> Subject: Re: ADO Command Component/SQL Syntax Question Date: Mon, 22 Oct 2001 10:06:58 -0600 Lines: 82 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2919.6600 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600 NNTP-Posting-Host: 207.34.102.197 Message-ID: <3bd44422$1_2@dnews> X-Trace: dnews 1003766818 207.34.102.197 (22 Oct 2001 09:06:58 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!feedme.news.mediaways.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnews