Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.clipper.visual-objects > #2411 > unrolled thread

Create MDB file

Started byFrans Wauters <fwa@telenet.be>
First post2011-11-10 12:25 +0100
Last post2011-11-14 10:41 +0100
Articles 8 — 4 participants

Back to article view | Back to comp.lang.clipper.visual-objects


Contents

  Create MDB file Frans Wauters <fwa@telenet.be> - 2011-11-10 12:25 +0100
    Re: Create MDB file "Willie Moore" <williem@wmconsulting.com> - 2011-11-10 12:29 -0600
      Re: Create MDB file Frans Wauters <fwa@telenet.be> - 2011-11-11 09:55 +0100
        Re: Create MDB file Johan Nel <johan.nel@xsinet.co.za> - 2011-11-11 01:39 -0800
    Re: Create MDB file E®!k \\/!$$E® <nospam@nospam.url> - 2011-11-11 10:36 +0100
    Re: Create MDB file Johan Nel <johan.nel@xsinet.co.za> - 2011-11-11 02:08 -0800
    Re: Create MDB file Frans Wauters <fwa@telenet.be> - 2011-11-14 10:41 +0100
    Re: Create MDB file Frans Wauters <fwa@telenet.be> - 2011-11-14 10:41 +0100

#2411 — Create MDB file

FromFrans Wauters <fwa@telenet.be>
Date2011-11-10 12:25 +0100
SubjectCreate MDB file
Message-ID<4EBBB4A0.D5898B11@telenet.be>
Greetings,
After a long time not programming, I have a new project. To get
acquainted into VO again, I’m fiddling around in VO28SP3, the newsgroup,
support.cavo.com etc. I stumbled over two code snips (functions) to
create an MDB database and even compactdatabase these MDB from “bare” VO
(not using 3th party tools). In my new project I need to export data in
an MS Access Database, so I was very pleased. I was starting to building
my own LIB with this code when bad luck strikes. I created a DLL with
the same name and without any warning VO28SP3 wiped my LIB. Does someone
have these two ADOX and JET routines by any chance ? I’m searching the
NG but I seems that the code is playing hide and seek.
Kind regards.
Frans

[toc] | [next] | [standalone]


#2418

From"Willie Moore" <williem@wmconsulting.com>
Date2011-11-10 12:29 -0600
Message-ID<j9h55a$eln$1@speranza.aioe.org>
In reply to#2411
Frans,

With VO, I used VO2ADO to read/write my access and SQL databases. Accessing 
mdb is a lot easier from Visual Studio (vulcan, vb, c#). If you only use VO, 
you would have to use the VO SQL classes or generate the ADO wrappers (OLE 
Server setup) so you could use ADO. I looked on the NG and could not find 
the library that you mentioned. You don’t by chance have a backup do you??? 
I use VOPP from VO to make a backup of my code every 20 minutes with a 
different directory created every day. That package has really saved me!

Regards,
Willie 

[toc] | [prev] | [next] | [standalone]


#2420

FromFrans Wauters <fwa@telenet.be>
Date2011-11-11 09:55 +0100
Message-ID<4EBCE30F.7E230083@telenet.be>
In reply to#2418

[Multipart message — attachments visible in raw view] — view raw

Hi Willy,

I use the VO SQL classes when I need SQLBase, MySQL, MS SQL or other databases
even for MS Access files. Past weeks I found in the NG two (I guess very old)
short posts when I was looking things up about non-ODBC (DSN less) connect
strings etc... One post with the create function and an other with the
compactdatabase implementation.

I am not into several add-on libaries. I used VO10. I upgraded easy from version
to version, never had a major problem. Still had some minor issues as with
RegisterIT with VO25 in the past. IMO a mature programming language must support
it from the box. Sure there are things that are build for very specific reasons,
but it never will help VO when VO does not assimilate it. Still I find VO a great
product, but I but it can be so much more.

I created a LIB in my VO Repository and put these function in. Normaly I create
some copy or export it in an AEF/MEF but I was not pleased when I created a DLL
with the same name of the LIB to find that the LIB was gone... no warning...
nothing.

My apps are still in VO27, a few years old but there are no problems with. My
VO28 is a few weeks old.

Regards,
Frans

[toc] | [prev] | [next] | [standalone]


#2422

FromJohan Nel <johan.nel@xsinet.co.za>
Date2011-11-11 01:39 -0800
Message-ID<650f7567-4312-4257-8027-1e77f74bca96@u6g2000vbg.googlegroups.com>
In reply to#2420
Frans,

I tried to find it, but I believe Erik Visser had posted an example of
how to Compact Access MDB from inside VO without any add-on libraries.
I tried to search for it, but no luck.  You might have some luck in
contacting him directly.

Regards,

Johan Nel
Pretoria, South Africa.

On Nov 11, 10:55 am, Frans Wauters <f...@telenet.be> wrote:
> Hi Willy,
>
> I use the VO SQL classes when I need SQLBase, MySQL, MS SQL or other databases
> even for MS Access files. Past weeks I found in the NG two (I guess very old)
> short posts when I was looking things up about non-ODBC (DSN less) connect
> strings etc... One post with the create function and an other with the
> compactdatabase implementation.
>
> I am not into several add-on libaries. I used VO10. I upgraded easy from version
> to version, never had a major problem. Still had some minor issues as with
> RegisterIT with VO25 in the past. IMO a mature programming language must support
> it from the box. Sure there are things that are build for very specific reasons,
> but it never will help VO when VO does not assimilate it. Still I find VO a great
> product, but I but it can be so much more.
>
> I created a LIB in my VO Repository and put these function in. Normaly I create
> some copy or export it in an AEF/MEF but I was not pleased when I created a DLL
> with the same name of the LIB to find that the LIB was gone... no warning...
> nothing.
>
> My apps are still in VO27, a few years old but there are no problems with. My
> VO28 is a few weeks old.
>
> Regards,
> Frans

[toc] | [prev] | [next] | [standalone]


#2421

FromE®!k \\/!$$E® <nospam@nospam.url>
Date2011-11-11 10:36 +0100
Message-ID<9i48kjF421U1@mid.individual.net>
In reply to#2411
Frans,

You can re-generate the base-classes from the Automation Server objects.
(Tools-Automation Servers)
If you take MS Jet and Replication Objects, you'll get a CompactDatabase 
method  (among others, like RefreshCache)

A whole set of classes and methods is available inside the MS Office 14.0 
Access Database Engine Object Library.


But it is a lot easier to use VO2ADO for the main parts. (You will not find 
functions like CompactDatabase and REfreshCache in there)

regards,

Erik


"Frans Wauters"  schreef in bericht news:4EBBB4A0.D5898B11@telenet.be...

Greetings,
After a long time not programming, I have a new project. To get
acquainted into VO again, I’m fiddling around in VO28SP3, the newsgroup,
support.cavo.com etc. I stumbled over two code snips (functions) to
create an MDB database and even compactdatabase these MDB from “bare” VO
(not using 3th party tools). In my new project I need to export data in
an MS Access Database, so I was very pleased. I was starting to building
my own LIB with this code when bad luck strikes. I created a DLL with
the same name and without any warning VO28SP3 wiped my LIB. Does someone
have these two ADOX and JET routines by any chance ? I’m searching the
NG but I seems that the code is playing hide and seek.
Kind regards.
Frans 

[toc] | [prev] | [next] | [standalone]


#2423

FromJohan Nel <johan.nel@xsinet.co.za>
Date2011-11-11 02:08 -0800
Message-ID<89a226b2-4f8d-4f99-8608-060e01c74bf2@p9g2000vbb.googlegroups.com>
In reply to#2411
Frans,

Further to my previous post.  I have found the following that should
work.  Just run a command from inside your VO app.

msaccess.exe <MDBFileName> /compact

Just make sure the MDB is not open.

HTH,

Johan Nel
Pretoria, South Africa.

On Nov 10, 1:25 pm, Frans Wauters <f...@telenet.be> wrote:
> Greetings,
> After a long time not programming, I have a new project. To get
> acquainted into VO again, I m fiddling around in VO28SP3, the newsgroup,
> support.cavo.com etc. I stumbled over two code snips (functions) to
> create an MDB database and even compactdatabase these MDB from bare VO
> (not using 3th party tools). In my new project I need to export data in
> an MS Access Database, so I was very pleased. I was starting to building
> my own LIB with this code when bad luck strikes. I created a DLL with
> the same name and without any warning VO28SP3 wiped my LIB. Does someone
> have these two ADOX and JET routines by any chance ? I m searching the
> NG but I seems that the code is playing hide and seek.
> Kind regards.
> Frans

[toc] | [prev] | [next] | [standalone]


#2432

FromFrans Wauters <fwa@telenet.be>
Date2011-11-14 10:41 +0100
Message-ID<4EC0E242.442EA819@telenet.be>
In reply to#2411

[Multipart message — attachments visible in raw view] — view raw

FUNCTION MDB_CreateDatabase( cFilename, cPassword, lEncrypt ) AS LOGIC

 // http://support.microsoft.com/kb/191754
 // http://msdn.microsoft.com/en-us/library/aa140022(v=office.10).aspx
 // http://msdn.microsoft.com/en-us/library/dd941291(v=office.12).aspx
 // http://msdn.microsoft.com/en-us/library/bb244889(v=office.12).aspx
 // http://msdn.microsoft.com/en-us/library/ms803865

 LOCAL oCatalog  AS OLEAUTOOBJECT
 LOCAL cProvider AS STRING

 Default( @cFilename, "C:\ACCESS.MDB" )
 Default( @cPassword, "Password" )
 Default( @lEncrypt, FALSE )

 IF File( cFilename )
  IF !FErase( cFilename )
   RETURN FALSE
  ENDIF
 ENDIF

 cProvider := "Provider=Microsoft.Jet.OLEDB.4.0;"
 cProvider := cProvider + "Data Source=" + cFilename + ";"
 cProvider := cProvider + "Jet OLEDB:Encrypt Database=" + IIF( lEncrypt,
"True", "False" ) + ";"
 cProvider := cProvider + "Jet OLEDB:Database Password=" + cPassword + ";"
* cProvider := cProvider + "Jet OLEDB:Engine Type=5;" // default: 5 = Access
2000, 4 = Access 97

 oCatalog := OLEAutoObject{ "ADOX.Catalog" }
 oCatalog:Create( cProvider )  // note: to compile, set compiler warning to
none
 oCatalog := NULL_OBJECT

 Collect()

 RETURN TRUE

[toc] | [prev] | [next] | [standalone]


#2433

FromFrans Wauters <fwa@telenet.be>
Date2011-11-14 10:41 +0100
Message-ID<4EC0E265.5F8C21B3@telenet.be>
In reply to#2411

[Multipart message — attachments visible in raw view] — view raw

FUNCTION MDB_CompactDatabase( cFilename, cPassword, lEncrypt ) AS LOGIC

 // http://msdn.microsoft.com/en-us/library/bb237197(v=office.12).aspx

 LOCAL oJetEngine AS OLEAUTOOBJECT
 LOCAL cSource  AS STRING
 LOCAL cTarget  AS STRING

 Default( @cFilename, "C:\ACCESS.MDB" )
 Default( @cPassword, "Password" )
 Default( @lEncrypt, TRUE )

 IF File( "C:\TARGET.MDB" )
  IF !FErase( "C:\TARGET.MDB" )
   RETURN FALSE
  ENDIF
 ENDIF

 cSource :=             "Provider=Microsoft.Jet.OLEDB.4.0;"
 cSource := cSource + "Data Source=" + cFilename + ";"
 cSource := cSource + "Jet OLEDB:Encrypt Database=" + IIF( lEncrypt, "True",
"False" ) + ";"
 cSource := cSource + "Jet OLEDB:Database Password=" + cPassword + ";"
* cSource := cSource + "Jet OLEDB:Engine Type=5" // 4 = Access 97, default:
5 = Access 2000

 cTarget :=             "Provider=Microsoft.Jet.OLEDB.4.0;"
 cTarget := cTarget + "Data Source=" + "C:\TARGET.MDB" + ";"
 cTarget := cTarget + "Jet OLEDB:Encrypt Database=" + IIF( lEncrypt, "True",
"False" ) + ";"
 cTarget := cTarget + "Jet OLEDB:Database Password=" + cPassword + ";"
* cTarget := cTarget + "Jet OLEDB:Engine Type=5" // 4 = Access 97, default:
5 = Access 2000

 oJetEngine := OLEAutoObject{ "JRO.JetEngine" }
 oJetEngine:CompactDatabase( cSource, cTarget ) // note: to compile, set
compiler warning to none
 oJetEngine := NULL_OBJECT

 Collect()

 IF File( "C:\TARGET.MDB" )
  DeleteFile( cFilename )
  FRename( "C:\TARGET.MDB", cFilename )
 ENDIF

 RETURN TRUE

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.clipper.visual-objects


csiph-web