Article View: borland.public.cppbuilder.database.ado
Article #4707Duplicate database found???
From: Stephane Baillargeon
Date: Sat, 17 Nov 2001 21:55
Date: Sat, 17 Nov 2001 21:55
75 lines
2957 bytes
2957 bytes
Source code follows explanation.
When My application runs and while assigning a TDatabase property whithin a
BPL, I get this error message:
Project ProjectName.exe raised exception class EDatabaseError with message
'Duplicate database name 'DatabaseName' ' . Process stopped. Use Step or Run
to continue.
What could be the cause of the problem?
AnsiString GetCaptionWithTag(int intLang, int intTag)
{
AnsiString strCaption = "";
TQuery *qryGetCaption = new TQuery(NULL);
TDatabase *dbGetCaption = new TDatabase(NULL);
// Set dbParams alias and login prompt false
dbGetCaption->DatabaseName = "Gestico";
dbGetCaption->LoginPrompt = false;
// Set qryParams alias
qryGetCaption->DatabaseName = "Gestico";
// Make sure that query is closed
qryGetCaption->Close();
// Set SQL select
qryGetCaption->SQL->Clear();
// Select field depending on language
switch(intLang)
{
case mintENGLISH:
{
qryGetCaption->SQL->Add("SELECT Cap_String_Eng AS Caption");
break;
}
case mintFRENCH:
{
qryGetCaption->SQL->Add("SELECT Cap_String_Fre AS Caption");
break;
}
default:;
}
qryGetCaption->SQL->Add("FROM Captions");
qryGetCaption->SQL->Add("WHERE Cap_NRI = :Tag");
qryGetCaption->Params->Items[0]->AsInteger = intTag;
// Prepare and open query
if(!qryGetCaption->Prepared)
{
qryGetCaption->UniDirectional = true;
qryGetCaption->Prepare();
}
// Open query
qryGetCaption->Open();
// Get caption if exists
if(!qryGetCaption->Eof)
strCaption = qryGetCaption->FieldByName("Caption")->AsString;
else
strCaption = "zError" + intTag;
// Close query
qryGetCaption->Close();
// Delete TDatabase and Tquery components
delete dbGetCaption;
delete qryGetCaption;
return strCaption;
}
Technical Details
Message-ID:
<3bf6dd7a_2@dnews>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!isdnet!fr.clara.net!heighliner.fr.clara.net!fr.usenet-edu.net!usenet-edu.net!bnewspeer01.bru.ops.eu.uu.net!emea.uu.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnewsShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10698b,61911af26fbf4da5,start X-Google-Attributes: gid10698b,public X-Google-ArrivalTime: 2001-11-17 14:08:54 PST From: "Stephane Baillargeon" <mbaillargeon@sympatico.ca> Newsgroups: borland.public.cppbuilder.database.ado Subject: Duplicate database found??? Date: Sat, 17 Nov 2001 16:55:04 -0500 Lines: 77 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: 65.94.164.144 Message-ID: <3bf6dd7a_2@dnews> X-Trace: dnews 1006034298 65.94.164.144 (17 Nov 2001 13:58:18 -0800) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!isdnet!fr.clara.net!heighliner.fr.clara.net!fr.usenet-edu.net!usenet-edu.net!bnewspeer01.bru.ops.eu.uu.net!emea.uu.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnews