SQL compact and 'refresh the data table'

  • Thread starter Thread starter Ian
  • Start date Start date
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.
 
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.
 
Back
Top