Error compacting a big DB

A

Alina

Hi

I try to compact a big SQL CE DB (about 300MB) on WinCE 4.2:
....
string src = textBoxDBName.Text;
string dest = textBoxTemp.Text;
string pswd = textBoxPswd.Text;
if (File.Exists(dest))
{
File.Delete(dest);
}
SqlCeEngine engine = new SqlCeEngine("Data Source = " + src + ";" +
"Password = " + pswd);
engine.Compact("Data Source = " + dest);
engine.Dispose();
File.Delete(src);
File.Move(dest, src);

The error I get at the Compact() method execution:
Application Try.exe has preformed an illegal operation and will be shut
down. If the problem
persists, contact the program vendor. Exception: 0xC0000005
Address:FFFFFFE4.

Thank you for any suggestion.
 
G

Ginny Caughey [MVP]

Alna,

Do you have enough space for two copies of the DB? Compacting a database in
Sql CE involves copying the old file to a new one, which could be almost as
big as the original one.
--
Ginny Caughey
..Net Compact Framework MVP

Have an opinion on the effectiveness of Microsoft Embedded newsgroups?
Let Microsoft know!
https://www.windowsembeddedeval.com/community/newsgroups
 
A

Alina

Hi
You're right, I changed the flash card with a bigger one and now I've got an
exception with 2 exceptions inside:
- Message "The SQL Server CE database cannot be compacted. [,,,,,]" string
- message "The column cannot contain null values. [,,,,,]" string
Thank you
 
Top