SQL compact and 'refresh the data table'

I

Ian

I'm using an SQL Compact DB in a forms application. When I do an
insert, I find that my DataRow's primary key remains invalid in memory
(-1) because it's not loaded the assigned primary key from the
identity column in the database. This is unsurprising, because
'refresh data table' is unchecked on the tableadapter.

However, the problem is that 'refresh data table' is greyed out in the
user interface (this is Visual Studio 2008). Can someone tell me why,
and what I can do about it?

Thanks,
Ian.
 
A

Arblewim

I'm using an SQL Compact DB in a forms application.  When I do an
insert, I find that my DataRow's primary key remains invalid in memory
(-1) because it's not loaded the assigned primary key from the
identity column in the database.  This is unsurprising, because
'refresh data table' is unchecked on the tableadapter.

However, the problem is that 'refresh data table' is greyed out in the
user interface (this is Visual Studio 2008).  Can someone tell me why,
and what I can do about it?

Thanks,
Ian.

To reply to myself, here's some extra information:

Normally the 'refresh data table' option for typed tableadapters would
make a two-part command with an INSERT followed by a SELECT. You're
not allowed multiple statements in one command when using SQL Compact
edition. This, I assume, is why the option is not available (...and
it would be nice if VS2008 told you that).

This doesn't solve my problem, however. Here's an easy to repeat
example: if, in SQL Compact, I create a simple table containing an
incrementing primary keyfield, and drop it onto a form from the 'data
sources' window of VS2008, the resulting form can easily be crashed.
You can insert a new row, but the application crashes if you save it
and then then change it.

So, can anyone help?

Thanks,
Ian.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top