🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.database.ado
5 messages
5 total messages Started by Elizabeth Fri, 03 Feb 2006 14:20
Using TAdoQuery to insert record in MS Access
#654
Author: Elizabeth
Date: Fri, 03 Feb 2006 14:20
7 lines
1135 bytes
Hi All,

I want to insert a record in MS access database using TAdoQuery.
Has anyone any idea how to do it ?

thanks,
Elizabeth.
Re: Using TAdoQuery to insert record in MS Access
#655
Author: Tom
Date: Fri, 03 Feb 2006 17:54
15 lines
1340 bytes
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.
> 
> 
Re: Using TAdoQuery to insert record in MS Access
#656
Author: 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.
> >
> >
Re: Using TAdoQuery to insert record in MS Access
#658
Author: Tom
Date: Mon, 06 Feb 2006 20:31
62 lines
2480 bytes
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.
>>>
>>>
> 
> 
Re: Using TAdoQuery to insert record in MS Access
#659
Author: Elizabeth
Date: Tue, 07 Feb 2006 05:49
72 lines
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.
> >>>
> >>>
> >
> >
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads