🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: What`s wrong this code?

#4112
From: Formentz
Date: Wed, 20 Mar 2002 08:36
53 lines
2525 bytes
Try to use an intermediate AnsiString to assign the property, in a program I
made there is an EditBox in where I build the connection string with a
function that shows the Connection dialog box like the one that the Object
inspector shows.

Method 1 : intermediate ansistring :
AnsiString conn="Provider=Microsoft.Jet.OLEDB.4.0;Password="";Data
Source=c:\\tmp.mdb;Persist Security Info=True";
Opti->ADOOpti->ConnectionString=conn;

Method 2 : PromptDataSource function :
you have to use a TEdit, a button and the TADOConnection :

//code of the OnClick of the TSpeedButton :
void __fastcall TForm1::sbConnectionClick(TObject *Sender)
{
 WideString ws=EditConnection->Text;
 EditConnection->Text=PromptDataSource((THandle)Handle,ws);
}

// when you open the ADOConnection do the following :
 if(ADOConn->Connected) ADOConn->Close();
 ADOConn->ConnectionString=EditConnection->Text;

This works for me, I think it should work for you too.

HTH
Ciao
    Formentz

"Slava Sh." <slava@space.com> ha scritto nel messaggio
news:3c984162_2@dnews...
>
> I copy that string to clipboard & then past it to WideString CS in my
Apps,
> then I launch Apps & I see ERRORS ! ;-(
>
> > To connect to access database usually I use a connection string like
this
> :
> >
> > Provider=Microsoft.Jet.OLEDB.4.0;Password="";Data
> Source=c:\\tmp.mdb;Persist
> > Security Info=True
>
> I need to change Data Source (path to database) in run-time between
several
> database.
>
> Thanks
> Slava
>
>
Technical Details
Message-ID: <3c9849df$1_1@dnews>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-01!supernews.com!newsfeed.online.be!newsfeeds.belnet.be!news.belnet.be!fr.usenet-edu.net!usenet-edu.net!fr.clara.net!heighliner.fr.clara.net!newsfeed01.sul.t-online.de!t-online.de!dnews
References: <3c96d743_1@dnews> <3c96f970$1_1@dnews> <3c96fcae_2@dnews> <3c9755df_2@dnews> <3c984162_2@dnews>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10698b,c2952da0fff9a65f
X-Google-Attributes: gid10698b,public
X-Google-ArrivalTime: 2002-03-20 00:39:19 PST
From: "Formentz" <francesco@leotron.com>
Newsgroups: borland.public.cppbuilder.database.ado
References: <3c96d743_1@dnews> <3c96f970$1_1@dnews> <3c96fcae_2@dnews> <3c9755df_2@dnews> <3c984162_2@dnews>
Subject: Re: What`s wrong this code?
Date: Wed, 20 Mar 2002 09:36:16 +0100
Lines: 55
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4522.1200
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200
NNTP-Posting-Host: 80.16.99.17
Message-ID: <3c9849df$1_1@dnews>
X-Trace: dnews 1016613343 80.16.99.17 (20 Mar 2002 00:35:43 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-01!supernews.com!newsfeed.online.be!newsfeeds.belnet.be!news.belnet.be!fr.usenet-edu.net!usenet-edu.net!fr.clara.net!heighliner.fr.clara.net!newsfeed01.sul.t-online.de!t-online.de!dnews