🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Create new database problem

#1491
From: Viatcheslav V. Vassiliev
Date: Thu, 22 Apr 2004 16:13
70 lines
2724 bytes
You are code is for MS SQL Server and will not run with any other DBMS. For
MS Jet (MS Access) use ADOX.

Import ADOX type library and execute

Adox_tlb::TCOM_Catalog cat = CoCatalog::Create();
 cat->Create(strConn.c_bstr());

or

  CatalogPtr cat = CoCatalog::Create();
  cat->Create(strConn);


You may also need to add

#include <comobj.hpp>

namespace System
{
 void __fastcall CheckSafecallResult(HRESULT hr)
 {
  OleCheck(hr);
 }
}

All strings should be declared as WideString, not as AnsiString.

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

"Martin Moeller" <martin.moeller@moema.it> �������/�������� � ��������
���������: news:4087d2f4@newsgroups.borland.com...
> Hi,
>
> I'm just starting with ADO and want to interface Access DB.
>
> Trying to create a new database file, I've 'copied' from other posts
> following code:
>
>   AdoCmd->CommandText =
>
>   " CREATE DATABASE [Admin]  ON (NAME = N'Admin', FILENAME = \
>   N'C:mymdf.mdf' , SIZE = 20, FILEGROWTH = 10%) LOG ON (NAME = \
>   N'Admin', FILENAME = N'C:\mymdf.ldf' , SIZE = 2, MAXSIZE = 13, \
>   FILEGROWTH = 10%)"
>   ;
>
>   Memo1->Lines->Append(AdoCmd->CommandText);
>
>   AdoCmd->Connection = ADOConnection;
>   AdoCmd->Execute();
>
> AdoCmd & AdoConnection are set on the Form; provider string for connection
> is Microsoft.Jet.OLEDB.4.0
>
> I get an exception for 'failed authentication'
>
> ?
>
> Anyone has a good link for an Ado tutorial or a quickstart?
>
> Tks & Rgds, Martin
>
>
Technical Details
Message-ID: <4087ef31$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <4087d2f4@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: 10698b,270202afc138267d
X-Google-Attributes: gid10698b,public
X-Google-ArrivalTime: 2004-04-22 09:40:42 PST
From: "Viatcheslav V. Vassiliev" <support@oledbdirect.com>
Newsgroups: borland.public.cppbuilder.database.ado
References: <4087d2f4@newsgroups.borland.com>
Subject: Re: Create new database problem
Date: Thu, 22 Apr 2004 20:13:39 +0400
Lines: 72
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 213.234.218.42
Message-ID: <4087ef31$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1082650417 213.234.218.42 (22 Apr 2004 09:13:37 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail