i am aware of the insert query. but i wanted to add data using command builder.
See my above example, creating the command builder an attaching it to your dataadapter, only allows the commandbuilder to get the structure of the tables from your selectcommand. You still have to individually assign each of the new commands to the appropiate commands in the dataadapter.
m_DataAdapter.InsertCommand = m_CommandBuilder.GetInsertCommand
m_DataAdapter.UpdateCommand = m_CommandBuilder.GetUpdateCommand
m_DataAdapter.DeleteCommand = m_CommandBuilder.GetDeleteCommand
On an additional note; I would suggest not using "Select
*" in conjunction with a command builder; instead explicitily write out each of the column names you want to work with. Previously I have run into problems doing the former mentioned.
Using the "Select *" method in conjuction with typed datasets causes an error with the command builder if you ever make changes to the database table in the future such as adding additional columns, regardless if you need to use them or not in your program, the typed dataset then no longer matches the command builders table structure. You would then need to go and update the typed datasets and redistribute the program with every change.