Fez Cobra III, Creating Sql Lite database to SD card

Hi,

example: https://www.ghielectronics.com/docs/135/sqlite-database
works fine and also an other example where I create a txt file to SD card works.
So communication to SD card should be ok.

But when I am trying to do: Database myDatabase = new GHI.SQLite.Database(“\SD\Database.dat”);
is giving an error.

What is the procedure, shall I mount first SD card and or create a Database.dat file at SD card
before new GHI.Database …??

Regards

Jari

1 Like

@ jari - Welcome to the forum. Can you post some code and the error-messages/debug-output so we can help you better, please.

hi,

here comes a little bit more what I am trying .

#1
Database myDatabase = new GHI.SQLite.Database(); //
This (above) works fine. It creates a database to RAM.

#2
Database myDatabase = new GHI.SQLite.Database("\SD\Database.dat");
This cause an error:
"#### Exception GHI.SQLite.Database+OpenException - 0x00000000 (1) ####
#### Message:
#### GHI.SQLite.Database::.ctor [IP: 002b] ####
#### MFConsoleApplication1.DataBase::.ctor [IP: 000c] ####
#### MFConsoleApplication1.Program::Main [IP: 0025] ####
A first chance exception of type ‘GHI.SQLite.Database.OpenException’ occurred in GHI.SQLite.dll
An unhandled exception of type ‘GHI.SQLite.Database.OpenException’ occurred in GHI.SQLite.dll

Uncaught exception
The thread ‘’ (0x1) has exited with code 0 (0x0).
Done.

So problem is related to SD card and the creation of database in to it.

Regards

Jari

[quote]What is the procedure, shall I mount first SD card and or create a Database.dat file at SD card
before new GHI.Database …??[/quote]

The SD must be mounted before it can be referenced.

1 Like

SOLVED!

Indeed, as Mike instructed the SD card must be first mounted before any operation can be
performed to that memory.

Thanks guys :slight_smile:

1 Like