views:

18

answers:

2

I can insert/update/delete fine from tables like product and such but this code fails with saying that the table AppAttribute does not exist. As I said, other tables are working fine...

    ExecuteNonQuery(BuildCommand(string.Format("DELETE FROM AppAttribute WHERE ProjectId={0};", ID)));
    ExecuteNonQuery(BuildCommand(string.Format("DELETE FROM CSVField WHERE ProjectId={0};", ID)));
    ExecuteNonQuery(BuildCommand(string.Format("DELETE FROM ExtraAttribute WHERE ProjectId={0};", ID)));

I have the following schema in my database:

BEGIN TRANSACTION;
CREATE TABLE AppAttribute (ProjectID NUMERIC, Name TEXT, Value TEXT);
CREATE TABLE AppData (PKey INTEGER PRIMARY KEY, KeyNo TEXT, FullName TEXT, EmailAddress TEXT, PostalCode TEXT, MagePassword TEXT, MageUserName TEXT, DomainName TEXT, ProductSheetTemplate TEXT);
INSERT INTO "AppData" VALUES(1,'','','','','MageCatPrinter','MageCatPrinter','http://www.ecosmartlight.com','Z:\dennisdecoene On My Mac\Documents\ML Solutions\EcoSmartLight\Productfiches\Voorbeeld van site\Sjabloon.html');
CREATE TABLE CSVField (ProjectID NUMERIC, Name TEXT, ExampleData TEXT);
CREATE TABLE ExtraAttribute (ProjectID NUMERIC, Name TEXT, PrintInTable NUMERIC);
CREATE TABLE Product (SKU TEXT, ProjectId NUMERIC, Name TEXT, AttributeSet INTEGER);
CREATE TABLE ProductAttribute (SKU TEXT, ProjectId NUMERIC, Key TEXT, Value TEXT);
CREATE TABLE Project (PKey INTEGER PRIMARY KEY, Name TEXT);
CREATE TABLE Template (Id INTEGER PRIMARY KEY, ProjectId NUMERIC, Type NUMERIC, Name TEXT, TemplateText TEXT);
COMMIT;

I'm also sure this is the schema the app is working with because it is my app that generated the dump.

A: 

Maybe you need to define a PK for table AppAttribute?

Tim
I think not because product does not have one either and that does work. But I'll try.
Dennis Decoene
No, did not work.
Dennis Decoene
A: 

It was a very strange problem. My connection string was this:

string _connectionString = @"Data Source=./Foo.db";

BUT!!! (Here it comes)

On the form I have an OpenFileDialog control. Now for some sick evil twisted reason, after opening the dialog and selecting a file, the current path is changed. If you then make a new connection, the "." in the connection string points to somewhere else.

So I changed my connection string to:

string _connectionString = @"Data Source=" + Application.StartupPath + "\\Foo.db";

The sky cleared up immediately...

PS I wasted half a day on this :(

Dennis Decoene