🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Accessing ADO from a console app

#1443
From: Viatcheslav V. Vassiliev
Date: Sun, 13 Jun 2004 13:13
112 lines
4091 bytes
It is not important. Change Unit1.cpp to

//--------------------------------------------------------------------------
-

#include <vcl.h>
#include <ADODB.hpp>
#include <DB.hpp>
#include <stdio.h>
#pragma hdrstop

//--------------------------------------------------------------------------
-

#pragma argsused
int main(int argc, char* argv[])
{
 CoInitialize(NULL);
 try
 {
  TADODataSet * ADODataSet1 = new TADODataSet(NULL);
  try
  {
   ADODataSet1->ConnectionString = WideString("Provider=SQLOLEDB;"
    "Integrated Security=SSPI;Initial Catalog=pubs;");
   ADODataSet1->CommandText = WideString("SELECT * FROM authors");
   ADODataSet1->Active = true;
   while (!ADODataSet1->Eof)
   {
    AnsiString str = ADODataSet1->FieldByName("au_id")->AsString + "\n";
    printf(str.c_str());
    ADODataSet1->Next();
   }
  }
  __finally
  {
   delete ADODataSet1;
  }
 }
 __finally
 {
  CoUninitialize();
 }

 return 0;
}
//--------------------------------------------------------------------------
-

and remove Unit2. The result is the same - all compiles fine. Compare
Project1.bpr with your .bpr - the error should be somewhere there.

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

"Blue Knight" <bevan231X@Xhotmail.com> ???????/???????? ? ????????
?????????: news:40cc4646$1@newsgroups.borland.com...
> Hi Vassiliev,
>
> Thanks for that, but the difference is that I am not actually creating
> any visual components - this is purely a console-based application that
> reads a log file and inserts records into a database.  Perhaps the fact
> that your application used a Form caused it to link with the adortl.lib
> and dbrtl.lib libraries, but I can't see how to force my app to do that
> in BCB6.
>
> Regards,
>
> Bevan
>
>
> Viatcheslav V. Vassiliev wrote:
>
> > I sent you test project that works OK.
> >
> > //------------------------------------------
> > 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)
> >
> > "Blue Knight" <bevan231X@Xhotmail.com> ???????/???????? ? ????????
> > ?????????: news:40cc09b4@newsgroups.borland.com...
> >
> >>Hi,
> >>
> >>Viatcheslav V. Vassiliev wrote:
> >>
> >>
> >>>Just turn off "Build with runtime packages" in
> >
> > "Project\Options\Packages"
> >
> >>>from IDE menu.
> >>
> >>I did that, and then it comes up with linker errors indicating that it
> >>couldn't resolve the ADO calls.  This is in spite of the fact that I
> >>created the Console app with VCL support enabled in BCB6.
> >>
> >>Regards,
> >>
> >>Bevan
> >
> >
> >
Technical Details
Message-ID: <40cc5304$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newshosting.com!nx02.iad01.newshosting.com!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <40cba892$1@newsgroups.borland.com> <40cc0329@newsgroups.borland.com> <40cc09b4@newsgroups.borland.com> <40cc252f$1@newsgroups.borland.com> <40cc4646$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10698b,6fc9a952b266d453
X-Google-Attributes: gid10698b,public
From: "Viatcheslav V. Vassiliev" <support@oledbdirect.com>
Newsgroups: borland.public.cppbuilder.database.ado
References: <40cba892$1@newsgroups.borland.com> <40cc0329@newsgroups.borland.com> <40cc09b4@newsgroups.borland.com> <40cc252f$1@newsgroups.borland.com> <40cc4646$1@newsgroups.borland.com>
Subject: Re: Accessing ADO from a console app
Date: Sun, 13 Jun 2004 17:13:41 +0400
Lines: 114
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: <40cc5304$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1087132420 213.234.218.42 (13 Jun 2004 06:13:40 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newshosting.com!nx02.iad01.newshosting.com!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail