How to refresh SOME records in the datagrid but NOT SQL Server ?

L

Lee Gillie

I am sure this is a dumb/simple question, but I am new to this stuff, so
request for patience with me...

I have OUTSIDE knowledge that there is activity regarding some records
in a parent / child set of tables I am showing in what I want to be a
read-only view in a grid. I have primary key values, but don't know if
it is just a change to existing records, or if the record was recently
inserted.

I want to reflect these changes to the grid in realtime as they occur,
by using the primary key to query certain records and get them updated
in the datagrid.

I started out binding the grid to a DataTable. But I had trouble
detecting column sorts, and the need to show some status information for
the current cell. I switched to using a DataView and that fixed that.
Then I wanted to show work-order/line-item levels, and so I created a
datarelation in a dataset, and bound to that, and this works (pretty good).

I thought if I queried JUST the work order and line items I know have
changed, this would be very efficient. I just need to integrate those
data updates to grid. From docs it appeared that DataTable.LoadDataRow
would allow me to import the values from the update query data set, and
would then update my grid with additions and row value changes. But I
get duplicate primary key errors, which suggests to me this is trying to
update the database, rather than just my in-memory dataset and the
display grid. This makes me wonder if I in any way change the dataset if
it will be attempting to post those to the database underneath, which I
do not want.

Am I going to have to implement my own list structure to bind to the
grid? If not, how is this done with datasets?
 
L

Lee Gillie

Ok, figured this out. Had to define PrimaryKey property for each
datatable in order to get LoadDataRow to NOT get exception. Works
wonderful now!
- Lee
 

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