Can you avoid pulling the primary key ID and tstamp with a bound datagrid

E

Earl

My delete SPs uses the simple structure of checking for the original primary
key and a timestamp. When I use currencymanager to delete a record from the
DataGrid, I've noticed that if I do not have the primary key and the
timestamp in the Select statement to populate the datagrid, I obviously
cannot delete. Yet I have no need for the primary key or timestamp otherwise
when I pull that data. It might seem like splitting hairs, but is there a
better technique that does not pull across unused data?
 
M

Miha Markic [MVP C#]

Hi Earl,

No, there isn't. How would you otherwise know that the record was modified?
Of course, you can blindy try to delete records but I wouldn't suggest you
this way :)
 
K

Kevin Yu [MSFT]

Thanks for Miha's quick response!

Hi Earl,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to know if you can fill the
DataSet without pulling primary key and timestamp from the database. If
there is any misunderstanding, please feel free to let me know.

I agree with Miha's idea that we cannot do this. A primary key is used to
identify the row. If the primary key isn't in the DataSet, when you have
made changes to the DataSet, the DataAdapter will not able to know which
record in database to update.

If anything is unclear, please feel free to reply to the post.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
E

Earl

Thanks to the both of you. I didn't think it was possible, but I couldn't
resist asking. :=)
 

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