Ado.net programming experience summary

Ado.net programming experience summary

Because Ado.net out years is not long, so information on programming skills like experience hard to find, there are a few of what technology insider, expert books, etc., are also tell us about the use of these components only. The actual problem encountered is varied, strange, deep understanding of Ado.net, they tend to be turtle half a day. Haha, I was always like this. Therefore, the future will continue to improve this post, I do not want others to walk the way I used to like.

The DataAdapter.Fill () a method for an attention to the situation.

DataAdapter.Fill () Methods Tim filling the form, the form of these Fill row state is coming Added, if DataAdapter.AcceptChangeDuingFill property is set to true , it will automatically call Table.AcceptChanges (), so that these states will be trekking It is unchanged. Otherwise, this can only be called manually Acceptchanges incident.

 

Cascading deletes, updates should pay attention to the problem

With ado.net the establishment of parent-child table, you can set up the link cascade update and cascade delete. But in the actual operation should be noted that the following conditions, such as the parent table to do a delete operation, but has not been called AcceptChanges event, then the child table will perform the same work, linked record is deleted state, the actual parent table in the record is still there, just delete the line into a state, if the time is called the parent table AcceptChanges event, due to the parent table in the row is actually deleted. Therefore, this recording child table having the erasure of the coupling do not meet the requirements, then forcibly removed quilt table. Instead of updating the database. So call Adapter.Update event, be sure to call the child table. Then call the parent table.

 

Description of data-bound controls can not add roll data:

If this is because the data-bound controls bind directly to DataTable.DefaultView , then rebuild a DataView perhaps the problem is solved. So it is best not to directly bind the control to DataTable on.

Published 30 original articles · won praise 2 · views 50000 +

Guess you like

Origin blog.csdn.net/khzide/article/details/518287