Insert method of TableAdapter not working?

后端 未结 2 1887
既然无缘
既然无缘 2020-12-20 18:42

I\'m using ADO.NET in my C# project. In my form I added a SourceBinding element from my toolbox in VS2010. I set the connection to the table of my dataset. It creates a Data

2条回答
  •  -上瘾入骨i
    2020-12-20 19:17

    I too was having difficulty figuring this out.

    You need to call DataSet.AcceptChanges() after the TableAdapter.Insert(...)

    That worked for me.

    So the steps are:

    1. Create your bindingsource, tableadapter and dataset using visual studio.
    2. TableAdapter.Fill(..) // this should automatically be added by vs.
    3. TableAdapter.Insert(..)
    4. DataSet.AcceptChanges()
    5. TableAdapter.Update(..)

提交回复
热议问题