Sqlite in memory with Dapper generates non-existent table error

Asked

Viewed 77 times

0

I have the following code for table creation:

            string query = @"CREATE TABLE GVP_USERS_TAGS(
                            ID integer NOT NULL PRIMARY KEY AUTOINCREMENT,
                            DATEINS datetime NOT NULL DEFAULT (DATETIME('now')),
                            NAME varchar(250) NOT NULL,
                            OWNER integer NOT NULL,
                            USER_ID integer NOT NULL,
                            PRODUCT_ID integer NOT NULL,
                            TYPE_ID integer NOT NULL,
                            VALUE varchar(250) NOT NULL,
                            PRODUCT_TYPE_ID integer NOT NULL,
                            Updated_Row timestamp NOT NULL,
                            MOVIE_TYPE_ID integer NOT NULL DEFAULT 0,
                            PIN_REQUIRED integer NOT NULL DEFAULT 0
                        )";
        return await queryExecutor.ExecuteAsync(query);

then use the following code:

var countQuery = $"SELECT COUNT(*) AS [Count] FROM GVP_USERS_TAGS NOLOCK {where}";
int count = await queryExecutor.ExecuteScalarAsync<int>(countQuery, parameters);

the following exception shall be made:

SQL logic error\\r\\nno such table: GVP_USERS_TAGS\

detail when filesystem usage works.

  • Can you place a Try in your queryExecutor.Executeasync(query); ? because the error is categorical in stating that the table does not exist so the problem is in creating it

1 answer

0


I managed to solve using _connection.Open();.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.