none
Insert/Update NULL dates using TableAdapter RRS feed

  • Question

  • Using VS 2017, I've got a TableAdapter, in which I'm trying to insert NULL dates--using its INSERT command.

    I'm being stopped when it encounters a DATE field, which is NULL.  (Allowable on the DB table.)

    What "magic" date value should I use, to allow the INSERT command to perform its intended function (successfully)?

    I'd prefer to NOT have to write additional methods, just to handle dealing with dates--otherwise, what would be the point of using the TableAdapter's INSERT command?  I may as well write my OWN Insert method.


    • Edited by robertd9031 Tuesday, November 12, 2019 3:30 PM
    Tuesday, November 12, 2019 3:30 PM

All replies

  • Hi robertd9031 ,

    I used the method TableAdapter.Insert to insert NULL date, but can’t reproduce the situation what you described.

    Here is my test code.

    private void Button1_Click(object sender, EventArgs e)
    {
                this.testTableAdapter.Fill(this.test_DatabaseDataSet.test);
                testTableAdapter.Insert(2, null);
    }

    Best Regards,

    Daniel Zhang 


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Wednesday, November 13, 2019 6:11 AM