Symptoms
If you use the CommandBuilder object to explicitly get commands for the DataAdapter object as follows:

da.InsertCommand = cb.GetInsertCommand and then run the following Visual Basic .NET code

cb.DataAdapter = Nothing or the following Visual C# .NET code

cb.DataAdapter = null; the commands that you add to the DataAdapter are deleted, and you receive the following error message:

An unhandled exception of type ‘System.NullReferenceException’ occurred in app_name.exe
Additional information: Object reference not set to an instance of an object.
Resolution
CommandBuilder deletes the commands that it generates when it is disassociated from a DataAdapter. CommandBuilder and DataAdapter are linked; when they are unlinked or disassociated, the commands are nulled. This problem does not affect commands that you build from the beginning (from scratch).