🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: small problem... (maybe huge...)

#3103
From: Vassiliev V.V.
Date: Tue, 17 Dec 2002 17:22
97 lines
4194 bytes
1.
AnsiString cDefaultDb = "c:\database.mdb";

should be

AnsiString cDefaultDb = "c:\\database.mdb";

2. You can check if cDb exists

if (!FileExists(cDb))
{
    throw ...
}

3. Remove ADOConnection->Provider = "Microsoft.Jet.OLEDB.4.0"; you have it
in connection string.

4. Do you have database password? If so, add

Jet OLEDB:Database Password="DbPassword";

to connection string.

5. Have you connection string to this file that works (try build it with
Connection string wizard - press "..." button in "Connection string"
property of TADOConnection)? Try to connect from this dialog and then build
connection string in run-time basing on existing and valid one.

----------------------------------------------------------------
Regards,
Viatcheslav V. Vassiliev
http://www.oledbdirect.com
The fastest way to access MS SQL Server, MS Jet (MS Access)
and Interbase (LCPI provider, http://ibp.lcpi.lipetsk.ru) databases.

"Ricardo Rodrigues" <madinfo@cadaval.net> �������/�������� � ��������
���������: news:3dff1cca@newsgroups.borland.com...
> this is my final code:
>
> void __fastcall TFormMain::GetConnectionString()
> {
>   AnsiString cIniFileName = ".//ge.ini"; // yo get on exe path

>
>   AnsiString cDb = "";
>
>   TIniFile *ini = new TIniFile(cIniFileName);
>   try
>   {
>      AnsiString cDb =  ini->ReadString( "mdb", "path", cDefaultDb);
>   }
>   __finally
>   {
>     delete ini;
>   }
>
>   AnsiString cConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;Password="";User
> ID=Admin;Data Source=" + cDb;
>
>   if(ADOConnection->Connected)
> //    ADOConnection->Close();
>     ADOConnection->Connected = false;
>     ADOConnection->ConnectionString = cConnStr;
>     ADOConnection->Provider = "Microsoft.Jet.OLEDB.4.0";
>     ADOConnection->Connected = true;
>     ADOTableMain->Active = true;
>     ADOQueryCount->Active = true;
>     ADOTableLocContact->Active = true;
> }
>
>
> i am calling it fro FormCreate.. void __fastcall
> TFormMain::FormCreate(TObject *Sender)
>
> and i get an error saying that Fails in autentication :(
>
>
> i�ve tryed all connection string that is:
> Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source=C:\Documents
and
> Settings\MaDiNfO_\Ambiente de trabalho\mdb\telefones.mdb;Mode=Share Deny
> None;Extended Properties="";Jet OLEDB:System database="";Jet
OLEDB:Registry
> Path="";Jet OLEDB:Database Password="";Jet OLEDB:Engine Type=5;Jet
> OLEDB:Database Locking Mode=1;Jet OLEDB:Global Partial Bulk Ops=2;Jet
> OLEDB:Global Bulk Transactions=1;Jet OLEDB:New Database Password="";Jet
> OLEDB:Create System Database=False;Jet OLEDB:Encrypt Database=False;Jet
> OLEDB:Don't Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica
> Repair=False;Jet OLEDB:SFP=False
>
>
> still nothing... can you see if you can help me?
>
> tanks one more time...
>
> and sorry my inglish but i am portuguese...
>
Technical Details
Message-ID: <3dff66df@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!news.tele.dk!news.tele.dk!small.news.tele.dk!fr.usenet-edu.net!usenet-edu.net!fr.clara.net!heighliner.fr.clara.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <3dfe179c@newsgroups.borland.com> <3dfe1baf$1@newsgroups.borland.com> <3dfe39de@newsgroups.borland.com> <3dfed6ef@newsgroups.borland.com> <3dff1cca@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: 10698b,1ced1a105f91efba
X-Google-Attributes: gid10698b,public
X-Google-ArrivalTime: 2002-12-17 10:12:31 PST
From: "Vassiliev V.V." <news@vassilievvv.mtu-net.ru>
Newsgroups: borland.public.cppbuilder.database.ado
References: <3dfe179c@newsgroups.borland.com> <3dfe1baf$1@newsgroups.borland.com> <3dfe39de@newsgroups.borland.com> <3dfed6ef@newsgroups.borland.com> <3dff1cca@newsgroups.borland.com>
Subject: Re: small problem... (maybe huge...)
Date: Tue, 17 Dec 2002 20:22:51 +0300
Lines: 102
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
NNTP-Posting-Host: 212.188.99.23
Message-ID: <3dff66df@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1040148191 212.188.99.23 (17 Dec 2002 10:03:11 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!news.tele.dk!news.tele.dk!small.news.tele.dk!fr.usenet-edu.net!usenet-edu.net!fr.clara.net!heighliner.fr.clara.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail