🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Create new database problem

#1508
From: Martin Moeller
Date: Tue, 27 Apr 2004 19:19
91 lines
4274 bytes
Hi Vassiliev,

> If you have MS Office, look
> C:\Program Files\Common Files\Microsoft Shared\OFFICEXX\XXXX\JETSQL40.CHM
> (XX are numbers, may differ for different office and language)
>
> for details on Jet SQL. In MSDN search for "Jet SQL" and check "Search in
> titles only". You will find 3 articles -
"Intermediate/Fundamental/Advanced
> Microsoft Jet SQL for Access 2000".
>

The MS-Office help path is a deadlock (installation of italian version is
completelly different & the help opened within office has all statements
translated as used in application wizards and thereby not good to form sql
statements).

The JetSQL search fails, but searching directly "Microsoft Jet SQL for
Access 2000" leads to those 3 articles & the *are* a very usefull
documentation.
Working through them.

I have a file open problem. My code deletes & creates a new database file.
It works fine only once per debugg session; the second time it fails as the
file is already open. What is wrong? I'm closing the connection.


void __fastcall TForm1::Button1Click(TObject *Sender)
{

  AnsiString FileName="..\\MsAccessTestFile.mdb";
  if(FileExists(FileName)==true)
    DeleteFile(FileName);

  // create new file
  WideString ConnStr="Provider=Microsoft.Jet.OLEDB.4.0;"
                      "Data Source=" + FileName;
  Adox_tlb::TCOM_Catalog cat = CoCatalog::Create();
  cat->Create(ConnStr.c_bstr());
  cat.Release();


  // Pass to TAdoConnection component

  ADOConnection->ConnectionString=ConnStr.c_bstr();
  ADOConnection->LoginPrompt=false;
  ADOConnection->Mode=cmShareDenyNone;
  ADOConnection->Provider="Microsoft.Jet.OLEDB.4.0";
  ADOConnection->Open();


  // creates Table Micro
  WideString ExecuteString="";
  ExecuteString=  "CREATE TABLE Micro"
                  "([PRKEY]   AutoIncrement NOT NULL, \
                    [MicID]   Text(16) NOT NULL, \
                    [Active]  DATETIME NULL, \
                    [Line]    Numeric NULL, \
                    [NetID]   Numeric NULL, \
                    [ErrSt]   Numeric NULL, \
                    [EepFile] NCHAR (20) NULL, \
                    [Notes]   Memo, \
                    PRIMARY KEY (PRKEY) \
                    )";
  ADOConnection->Execute(ExecuteString.c_bstr());

  ExecuteString=  "CREATE TABLE  Lines" \
                  ( [VerDate]   DATETIME  NOT NULL, \
                    [Line]      Numeric NOT NULL, \
                    [ComPort]   NCHAR (5) NULL, \
                    [BaudRate]  Numeric NULL, \
                    [Type]      NCHAR (6) NULL, \
                    [Notes]     Memo, \
                    PRIMARY KEY (VerDate,Line) \
                    )";

  ADOConnection->Execute(ExecuteString.c_bstr());


  ExecuteString=  "CREATE INDEX idxMicId"
                  "ON Micro (MicID DESC)" ;

  ADOConnection->Execute(ExecuteString.c_bstr());

  ADOConnection->Close();

}


Tks, Martin
Technical Details
Message-ID: <408eb23f$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news.glorb.com!cyclone1.gnilink.net!gnilink.net!peer01.cox.net!cox.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
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> <4089186f@newsgroups.borland.com> <408924bc@newsgroups.borland.com> <40895c5a@newsgroups.borland.com> <40896fcc$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-27 12:30:03 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> <4089186f@newsgroups.borland.com> <408924bc@newsgroups.borland.com> <40895c5a@newsgroups.borland.com> <40896fcc$1@newsgroups.borland.com>
Subject: Re: Create new database problem
Date: Tue, 27 Apr 2004 21:19:22 +0200
Lines: 93
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: <408eb23f$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1083093567 212.171.6.186 (27 Apr 2004 12:19:27 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news.glorb.com!cyclone1.gnilink.net!gnilink.net!peer01.cox.net!cox.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail