🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.database.ado
Article #656

Re: Using TAdoQuery to insert record in MS Access

#656
From: Elizabeth
Date: Mon, 06 Feb 2006 04:32
44 lines
1984 bytes
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: <43e6cff4@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!newsfeed.gamma.ru!Gamma.RU!news-lond.gip.net!news.gsl.net!gip.net!diablo.netcom.net.uk!netcom.net.uk!194.72.7.126.MISMATCH!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <43e3653b$1@newsgroups.borland.com> <43e39813$1@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>
Subject: Re: Using TAdoQuery to insert record in MS Access
Date: Mon, 6 Feb 2006 10:02:52 +0530
Lines: 46
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: 203.199.147.242
Message-ID: <43e6cff4@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1139199988 203.199.147.242 (5 Feb 2006 20:26:28 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!newsfeed.gamma.ru!Gamma.RU!news-lond.gip.net!news.gsl.net!gip.net!diablo.netcom.net.uk!netcom.net.uk!194.72.7.126.MISMATCH!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail