Precautions for using the update method of tableadapter

Source: Internet
Author: User


Use. Net to compile an InterfaceProgramIt involves data access. The working language has always been c ++, and the self-confidence msdn is in the hands. In the case of a C # ADO program, the MVC Architecture is probably designed.
Under the framework of the program, the function of capturing and displaying data is quickly completed, but the function of writing dirty data back to the database using update cannot be achieved, and the return value of update is also 0. The method is reference.
As mentioned in the example on msdn, there is no problem, but the reality is cruel. Next we started the long and tangled 25,000-mile long march to find a solution, the process saves 10 thousand words ......

Summarize experiences directly

First, the database table design must have a primary key to ensure that the dataset file generated based on the data table contains the complete insert, delete,
Update,
Select SQL statement. If the table does not have a primary key, the SELECT statement can only be normal. Check the ***. Designer. CS file. Freight expert


Second, the sample program provided by msdn is incorrect. You must call the endedit method before calling update. I personally think that Microsoft needs endedit in the update Method
If this parameter is triggered, the dirty data is written to the corresponding able, so that the update statement is executed based on the data changes.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.