Like the subject says, I'm using strongly typed datasets. I'm using to designer to create the datasets and the methods. I can select and insert, but I can't update or delete.
I right click on the adapter bar and select Add Query.
I sleect 'Use SQL Statements'
I select 'Update' (or 'Delete')
I get a sql statement pane containing the word 'Update' ('Delete') and asking 'What data should the table load?'
I can click on next, but anything else gives me errors. I'd list them, but I'm clearly doing something wrong and it's probably obvious.
Diane
Have you made sure that you have set a primary key for your table.|||The table didn't have a primary key. I added one, but I still don't know how I'm supposed to use update and delete in a recordset.
Diane
Hi Diane,
You can remove and re-add the TableAdapter. Set the SELECT command to select from that table which has primary key.
When you walk to the end of the wizard, it will show you that Update and Delete methods are generated. In this case, you will be able to Update and Delete through the TableAdapter.
|||Update and Delete have been generated, I just don't know how to use them.
Diane
|||Hi Diane,
When you have generated the Update and Delete methods, you can call them directly from an instance of TableADapter.
The Update method has several overloads. Some take a DataRow or a DataSet. They can update rows in batch. There is another overload that takes each field value seperately.
The Delete method takes arguments for all the field values, and it will check then delete the row.
HTH. If this does not answer your question, please feel free to mark the post as Not Answered and reply. Thank you!
No comments:
Post a Comment