🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Problem with limited SELECT

#883
From: Giovanni
Date: Tue, 22 Feb 2005 22:53
25 lines
2058 bytes
Hi, I'm trying to make a select query to an excel file, but I wish make 
it on a user defined range. I tryed with this code, but it gives me some 
error:

//ArchivioEsterno=TADODataset
//Edit1->Text=File Excel
//Edit2->Text=Name of the worksheet
//Maskedits are the extreme points of selection

ModuloDati->ArchivioEsterno->Close();
AnsiString Provider="Provider=Microsoft.Jet.OLEDB.4.0;";
AnsiString DataSource="Data Source=" + Edit1->Text + ";";
AnsiString AccessMode="Mode=Read;";
AnsiString ExtProperties="Extended Properties=Excel 8.0;";
AnsiString SecurityInfo="Persist Security Info=False";
ModuloDati->ArchivioEsterno->ConnectionString=Provider+DataSource+AccessMode+ExtProperties+SecurityInfo;
AnsiString Selezione="";
if (MaskEdit3->Text!=MaskEdit4->Text) Selezione=MaskEdit3->Text + ":" + 
MaskEdit4->Text;
ModuloDati->ArchivioEsterno->CommandText="Select * from [" + Edit2->Text 
+ "$" + Selezione + "]";
ModuloDati->ArchivioEsterno->Prepared;
ModuloDati->ArchivioEsterno->Open();

tnx in advance
Technical Details
Message-ID: <421bb7d0@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!feeder2.on.meganewsservers.com!meganewsservers.com!textfeed1.on.meganewsservers.com!38.119.100.83.MISMATCH!news-out.nntp.be!propagator2-sterling.newsfeeds.com!news-in.nuthinbutnews.com!news-in.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 10698b,3035b4eeb1173fcf,start
X-Google-Attributes: gid10698b,public
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Tue, 22 Feb 2005 23:53:02 +0100
From: Giovanni <nightshade@tiscali.it>
User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206)
X-Accept-Language: it, it-it, en-us, en
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.database.ado
Subject: Problem with limited SELECT
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 217.201.70.155
Message-ID: <421bb7d0@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1109112784 217.201.70.155 (22 Feb 2005 14:53:04 -0800)
Lines: 25
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!feeder2.on.meganewsservers.com!meganewsservers.com!textfeed1.on.meganewsservers.com!38.119.100.83.MISMATCH!news-out.nntp.be!propagator2-sterling.newsfeeds.com!news-in.nuthinbutnews.com!news-in.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail