Article View: borland.public.cppbuilder.database.ado
Article #1497Re: Create new database problem
From: Martin Moeller
Date: Fri, 23 Apr 2004 13:21
Date: Fri, 23 Apr 2004 13:21
51 lines
2357 bytes
2357 bytes
Modified the code after importing the ADOX libray as suggetsed, but still
can not create my first database.
I get an exception for Widestring/variant conversion. It is:
Project ... raised exception class EOleException with message
'(this->Create(ConnectString, (VARIANT*)&Connection)) Error: 80040E17
(-2147217897) @...
The source is just:
void __fastcall TForm1::Button1Click(TObject *Sender)
{
// if(CoInitialize(NULL)!=S_OK)
Beep();
WideString strConn="Provider=Microsoft.Jet.OLEDB.4.0; \
Data Source=.\\New.mdb; \
";
Adox_tlb::TCOM_Catalog cat = CoCatalog::Create();
cat->Create(strConn.c_bstr());
// CoUninitialize();
}
I also tried but get the same error using a catalog component placed on the
Form
void __fastcall TForm1::Button1Click(TObject *Sender)
{
WideString strConn="Provider=Microsoft.Jet.OLEDB.4.0; \
Data Source=.\\New.mdb; \
";
AdoxCatalog1->Create(strConn.c_bstr());
}
while the suggested alternative returns a double declaration compiler erros
CatalogPtr cat2 = CoCatalog::Create();
cat2->Create(strConn);
Tks, Martin
Technical Details
Message-ID:
<4089186f@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news.glorb.com!hammer.uoregon.edu!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<4087d2f4@newsgroups.borland.com> <4087ef31$1@newsgroups.borland.com> <4087ff9c$1@newsgroups.borland.com> <40881473$1@newsgroups.borland.com> <40881b61$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10698b,270202afc138267d X-Google-Attributes: gid10698b,public X-Google-ArrivalTime: 2004-04-23 06:35:08 PST Reply-To: "Martin Moeller" <martin.moeller@moema.it> From: "Martin Moeller" <martin.moeller@moema.it> Newsgroups: borland.public.cppbuilder.database.ado References: <4087d2f4@newsgroups.borland.com> <4087ef31$1@newsgroups.borland.com> <4087ff9c$1@newsgroups.borland.com> <40881473$1@newsgroups.borland.com> <40881b61$1@newsgroups.borland.com> Subject: Re: Create new database problem Date: Fri, 23 Apr 2004 15:21:48 +0200 Lines: 53 Organization: Moe.Ma Italiana Srl X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1409 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 NNTP-Posting-Host: 212.171.6.186 Message-ID: <4089186f@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1082726511 212.171.6.186 (23 Apr 2004 06:21:51 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news.glorb.com!hammer.uoregon.edu!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail