Article View: borland.public.cppbuilder.database.ado
Article #659Re: Using TAdoQuery to insert record in MS Access
From: Elizabeth
Date: Tue, 07 Feb 2006 05:49
Date: Tue, 07 Feb 2006 05:49
72 lines
2920 bytes
2920 bytes
Hey Thanks a lot Tom.
As you said I was not naming the fields before entering data.
I named the fields in the excel sheet and then entered the data it worked
:-)
Thanks,
Elizabeth
"Tom" <tom@net.com> wrote in message news:43e7b12c@newsgroups.borland.com...
> It looks like you're trying to enter text data in non text field, so
> check if you are inserting the correct data into the correct fields?
>
> When entering data, name the fields in which you want to enter data, and
> then add corresponding values.
>
> ADOQuery1->SQL->Add("INSERT INTO [Sheet1](firstName, middleName,
> lastName, age) VALUES('Luka','Gigi','Majnaric','25')
>
>
> Regards
>
>
>
>
> Elizabeth wrote:
> > Hi,
> >
> > Your solution worked. Now I want to insert a record in an excel sheet.
> > The following code works when I am inserting a numeric record. e.g
> >
> > ADOQuery1->SQL->Add("Insert into [Sheet1$] Values('1', '2')");
> >
> > ADOQuery1->ExecSQL();
> > ADOQuery1->Close();
> >
> > But I want to insert text in an excel sheet.
> > I am using the following code
> > ADOQuery1->SQL->Add("Insert into [Sheet1$] Values('A', 'B')");
> >
> > ADOQuery1->ExecSQL();
> > ADOQuery1->Close();
> >
> >
> > But I get a "datatype mismatch error".
> > Has anyone any solution how to do it ?
> >
> > Thanks,
> > Elizabeth.
> >
> >
> >
> >
> > "Tom" <tom@net.com> wrote in message
> > news:43e39813$1@newsgroups.borland.com...
> >> ADOQuery1->SQL->Add("INSERT INTO TableName (FieldName1,FieldName2,...)
> >> VALUES ('Value1','Value2',...)");
> >> ADOQuery1->Open();
> >>
> >>
> >> Elizabeth wrote:
> >>> Hi All,
> >>>
> >>> I want to insert a record in MS access database using TAdoQuery.
> >>> Has anyone any idea how to do it ?
> >>>
> >>> thanks,
> >>> Elizabeth.
> >>>
> >>>
> >
> >
Technical Details
Message-ID:
<43e83354$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news4.google.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx02.iad01.newshosting.com!newshosting.com!news-peer0-test!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<43e3653b$1@newsgroups.borland.com> <43e39813$1@newsgroups.borland.com> <43e6cff4@newsgroups.borland.com> <43e7b12c@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10698b,dd1624c1f8b2994c X-Google-Attributes: gid10698b,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Elizabeth" <vaab@hcncjk.com> Newsgroups: borland.public.cppbuilder.database.ado References: <43e3653b$1@newsgroups.borland.com> <43e39813$1@newsgroups.borland.com> <43e6cff4@newsgroups.borland.com> <43e7b12c@newsgroups.borland.com> Subject: Re: Using TAdoQuery to insert record in MS Access Date: Tue, 7 Feb 2006 11:19:11 +0530 Lines: 74 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1506 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1506 NNTP-Posting-Host: 220.225.37.82 Message-ID: <43e83354$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1139290964 220.225.37.82 (6 Feb 2006 21:42:44 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news4.google.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx02.iad01.newshosting.com!newshosting.com!news-peer0-test!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail