🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Insert problem

#123
From: Tomislav Hundric'
Date: Sat, 15 Sep 2007 14:34
100 lines
4302 bytes
Thanks Vassilev, I'm very distracted today, seems I didn't check for 
escape character in my path... so as you can guess it solved problem. I 
apologize for asking before I double checked my code...

Thanks,
Tomisalv


Vassiliev V. V. wrote:
> Inside C++: ... Database=c:\\myxls ... . I.e. do you escape '\' character in 
> path? Are you sure that enumeration starts from 0, not from 1, i.e. do you 
> have file c:\myxls0.xls?
> 
>> ADOQuer1->SQL->Add(...)
> 
> Do you clear ADOQuery1->SQL before calling Add()?
> 
> //------------------------------------------
> Regards,
> Vassiliev V. V.
> http://www.managed-vcl.com - using .Net objects in Delphi for Win32 +
> ADO.Net
> http://www.oledbdirect.com - The fastest way to access MS SQL Server,
> MS Jet (Access) and Interbase (through OLEDB)
> 
> 
> "Tomislav Hundric'" <rifnet@gmail.com> �������/�������� � �������� 
> ���������: news:46ebc074$1@newsgroups.borland.com...
>> I'm sorry for asking before looking into help, I've managed to do it via 
>> ADOCommand, but now I've got other question regarding my previous post 
>> about inserting excel file into Table.
>>
>> Since I'm using:
>>
>> INSERT INTO MyTable(Col1, Col2)
>> SELECT Col1, Col2
>> FROM [Sheet1$] IN ""[Excel 8.0;Database=c:\myxls.xls]
>>
>> and that works fine when I enter it into SQL property of ADOQuery, but 
>> I'll be inserting lets say 10 or more excel files into table, I'm thinking 
>> of using loop that will add
>>
>> ...""[Excel 8.0;Database=c:\myxls1.xls]
>> ...""[Excel 8.0;Database=c:\myxls2.xls]
>> ...""[Excel 8.0;Database=c:\myxls3.xls]
>> ...
>>
>> since there are two quatation marks in front of the brackets, I don't know 
>> how to apply them to my string correctly.
>>
>> String SQL = "INSERT INTO MyTable(Col1, Col2)SELECT Col1, Col2 FROM 
>> [Sheet1$] IN \"\"";
>>
>> for (int i= 0; i < someNumber; i++){
>> ADOCommand1->CommandText= SQL + "[Excel 8.0;Database=c:\myxls" + 
>> IntToStr(i) +".xls]";
>> ADOCommand1->Execute();
>> }
>>
>> or
>>
>> for (int i= 0; i < someNumber; i++){
>> ADOQuer1->SQL->Add(SQL + "[Excel 8.0;Database=c:\myxls" + IntToStr(i) 
>> +".xls]";
>> ADOQuery1->ExecSQL();
>> }
>>
>>
>> Both of them throw me an exception "Microsoft Jet database engine could 
>> not find object Sheet1..." is there some other way to solve this.
>>
>> Again, thanks in advance,
>> Tomislav.
>>
>> Tomislav Hundric' wrote:
>>> Hi,
>>> I've got a question regarding insert into table, I'm using access 
>>> database, ADOConnection and ADOQuery:
>>>
>>>
>>> I have SQL like this:
>>>
>>> Insert into Table1 (Field1)
>>> Select distinct Field2
>>>  From Table2
>>>
>>> Executing this query throws me this error
>>>
>>> "current provider does not not support returning multiple recordsets from 
>>> simple execution"
>>>
>>> When I look into my table I can see that records are added even though an 
>>> error was thrown. Basically what I'm trying to do is to fill relational 
>>> tables with data from one temp table. Is my approach ok, or should I do 
>>> this in some other way.
>>>
>>> Thanks in advance,
>>> Tomislav. 
> 
> 
Technical Details
Message-ID: <46ebed85@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <46eba5b2@newsgroups.borland.com> <46ebc074$1@newsgroups.borland.com> <46ebe03d$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10698b,2042ce4cafe32ddf
X-Google-Attributes: gid10698b,public,usenet
X-Google-Language: ENGLISH,CP1252
Date: Sat, 15 Sep 2007 16:34:05 +0200
From: Tomislav Hundric' <rifnet@gmail.com>
User-Agent: Thunderbird 2.0.0.6 (Windows/20070728)
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.database.ado
Subject: Re: Insert problem
References: <46eba5b2@newsgroups.borland.com> <46ebc074$1@newsgroups.borland.com> <46ebe03d$1@newsgroups.borland.com>
In-Reply-To: <46ebe03d$1@newsgroups.borland.com>
Content-Type: text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding: 8bit
NNTP-Posting-Host: 83.131.43.115
Message-ID: <46ebed85@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1189866885 83.131.43.115 (15 Sep 2007 07:34:45 -0700)
Lines: 100
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail