ADOCE 3.0, cannot create a new database 
Author Message
 ADOCE 3.0, cannot create a new database

I'm attempting to create a database on my Dell Axim (Pocket PC 2002) using
eVB.  This database is being used to populate a TreeView, and a ListView.
If I
create the file via a transfer of an Access file to the Axim, all goes well.
The program
is able to open the file with no problems.  If, however, I try and create a
new
database, it fails.

If fs.Dir(theDB) = "" Then 'theDB is a variable pointed to "\My
Documents\MyMusic.cdb"
        'create the database in the My Documents folder
        Set rs = CreateObject("ADOCE.Recordset.3.0")
        rs.Open "CREATE DATABASE '" & theDB & "'"

When I run the above code, it gets to the Ser rs statement, but then fails
when it
attempts to open the DB.  The message states "cannot locate file, or
object".  What's
funny about this is that this a sample straight from the PPC 2002 SDK.  It
works fine
under emulation.  I'm lost as to what is causing this.  I cannot always rely
on being able
to create a file on the PC first.

Ophbalance



Tue, 18 Oct 2005 03:08:19 GMT  
 ADOCE 3.0, cannot create a new database
By not providing a connection, it tries to use the natice store, which I
don't think will accept a new database.  Either give it a connection string
so it can create a CDB or just use  CREATE TABLE.

--
Chris Tacke, eMVP
Windows CE Product Manager
Applied Data Systems
www.applieddata.net


Quote:
> I'm attempting to create a database on my Dell Axim (Pocket PC 2002) using
> eVB.  This database is being used to populate a TreeView, and a ListView.
> If I
> create the file via a transfer of an Access file to the Axim, all goes
well.
> The program
> is able to open the file with no problems.  If, however, I try and create
a
> new
> database, it fails.

> If fs.Dir(theDB) = "" Then 'theDB is a variable pointed to "\My
> Documents\MyMusic.cdb"
>         'create the database in the My Documents folder
>         Set rs = CreateObject("ADOCE.Recordset.3.0")
>         rs.Open "CREATE DATABASE '" & theDB & "'"

> When I run the above code, it gets to the Ser rs statement, but then fails
> when it
> attempts to open the DB.  The message states "cannot locate file, or
> object".  What's
> funny about this is that this a sample straight from the PPC 2002 SDK.  It
> works fine
> under emulation.  I'm lost as to what is causing this.  I cannot always
rely
> on being able
> to create a file on the PC first.

> Ophbalance



Tue, 18 Oct 2005 04:03:40 GMT  
 ADOCE 3.0, cannot create a new database
This is what I do to create a local Db...

Public Function CreateNewDb() As Boolean

' Ensure that you have Microsoft CE ADO Control 3.0 selected in Project->References
' Note: You will need to check which version of ADO you have, it might be 3.1!

Dim ADOCEConnection As ADOCE.Connection

Const ADOCE_CLASS_CONNECTION = "ADOCE.Connection.3.0"
Const DB_NAME = "\YourDbPath\YourDbName.cdb"

    CreateNewDb = False

    Set ADOCEConnection = CreateObject(ADOCE_CLASS_CONNECTION)

    ADOCEConnection.Open

    ' create the db
    ADOCEConnection.Execute "CREATE DATABASE '" & DB_NAME & "'"

    If Err.Number = 0 Then CreateNewDb = True

    ' The db should now be created, you will now have to add the required tables!

End Function

This code is taken from a working application, although I have not tested this
code snippet in isolation.

Hope this helps

Paul Newton

Quote:

> I'm attempting to create a database on my Dell Axim (Pocket PC 2002) using
> eVB.  This database is being used to populate a TreeView, and a ListView.
> If I
> create the file via a transfer of an Access file to the Axim, all goes well.
> The program
> is able to open the file with no problems.  If, however, I try and create a
> new
> database, it fails.

> If fs.Dir(theDB) = "" Then 'theDB is a variable pointed to "\My
> Documents\MyMusic.cdb"
>         'create the database in the My Documents folder
>         Set rs = CreateObject("ADOCE.Recordset.3.0")
>         rs.Open "CREATE DATABASE '" & theDB & "'"

> When I run the above code, it gets to the Ser rs statement, but then fails
> when it
> attempts to open the DB.  The message states "cannot locate file, or
> object".  What's
> funny about this is that this a sample straight from the PPC 2002 SDK.  It
> works fine
> under emulation.  I'm lost as to what is causing this.  I cannot always rely
> on being able
> to create a file on the PC first.

> Ophbalance



Tue, 18 Oct 2005 16:41:35 GMT  
 ADOCE 3.0, cannot create a new database
Paul,

I tried this, and if I run it under emulation, it works fine.  When I
try it on the Axim, I get

"An error was encountered
while running this program:
The system cannot open
the
device or file specified."

I'm starting to suspect I may be in need to a hard reset.  I've soft
reset several times, and this message still appears.  I've tried setting
the path to just "\myDB.cdb".  I also made sure that the ADO is
referenced.

Ophbalance


Quote:
> This is what I do to create a local Db...

> Public Function CreateNewDb() As Boolean

> ' Ensure that you have Microsoft CE ADO Control 3.0 selected in
Project->References
> ' Note: You will need to check which version of ADO you have, it might be
3.1!

> Dim ADOCEConnection As ADOCE.Connection

> Const ADOCE_CLASS_CONNECTION = "ADOCE.Connection.3.0"
> Const DB_NAME = "\YourDbPath\YourDbName.cdb"

>     CreateNewDb = False

>     Set ADOCEConnection = CreateObject(ADOCE_CLASS_CONNECTION)

>     ADOCEConnection.Open

>     ' create the db
>     ADOCEConnection.Execute "CREATE DATABASE '" & DB_NAME & "'"

>     If Err.Number = 0 Then CreateNewDb = True

>     ' The db should now be created, you will now have to add the required
tables!

> End Function

> This code is taken from a working application, although I have not tested
this
> code snippet in isolation.

> Hope this helps

> Paul Newton



Wed, 19 Oct 2005 02:28:08 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Cannot create a Table using ADOCE

2. ppc 2002,evb 3.0,adoce 3.1 Can't create object

3. Forcing Database Changes from ADOCE to Commit - new deVBuzz tutorial

4. Creating Database using ADOCE.3.1

5. Repost: Cannot create property for new table

6. Cannot create new record using rs.AddNew

7. Challenge to VB 3.0 / Access 2.0 guru: Creating new field of type Counter

8. Cannot create a new workspace..

9. Cannot create New Winsock and Inet controls

10. Cannot create new report based on query

11. Cannot see the new created View in Access

12. Using catalog.create to create a new Excel database

 

 
Powered by phpBB® Forum Software