🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Problem with limited SELECT

#886
From: Viatcheslav V. Vassiliev
Date: Wed, 23 Feb 2005 08:05
48 lines
2756 bytes
What exactly you have as connection string and query?

ModuloDati->ArchivioEsterno->ConnectionString = "...";
ModuloDati->ArchivioEsterno->CommandText = "..."

Set ParamCheck = false on ModuloDati->ArchivioEsterno - otherwise anything 
after ':' is parameter.

> ModuloDati->ArchivioEsterno->Prepared;

Should be ModuloDati->ArchivioEsterno->Prepared = true;

//------------------------------------------
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)


"Giovanni" <nightshade@tiscali.it> ???????/???????? ? ???????? ?????????: 
news:421bb7d0@newsgroups.borland.com...
> 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: <421c393c$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!newsfeed.icl.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <421bb7d0@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10698b,3035b4eeb1173fcf
X-Google-Attributes: gid10698b,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Viatcheslav V. Vassiliev" <support@oledbdirect.com>
Newsgroups: borland.public.cppbuilder.database.ado
References: <421bb7d0@newsgroups.borland.com>
Subject: Re: Problem with limited SELECT
Date: Wed, 23 Feb 2005 11:05:17 +0300
Lines: 50
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2527
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527
X-RFC2646: Format=Flowed; Response
NNTP-Posting-Host: 85.93.137.143
Message-ID: <421c393c$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1109145916 85.93.137.143 (23 Feb 2005 00:05:16 -0800)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!newsfeed.icl.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail