none
Using OleDbDataAdapter to update DataTable with data field that is not required but with AllowZeroLength = false RRS feed

  • Question

  • Hi,

    I am working on an issue on using the OleDbDataAdapter.Update() method to update an MS Access database table with data stored in the DataTable variable, in C#.

    The issue is that the database table has some fields in the table set with "AllowZeroLength" = false. 

    I know an easy to get around is to update the database file itself so that all the "AllowZeroLegnth" property is set to true.  Anyhow, there are a lot of existing database file and some is not in my control.

    I want to know if there is a way around so that I don't have send out a distributed messages asking everyone to update their database file?

    Thanks.

    Peggy

    • Moved by Stanly Fan Monday, April 2, 2018 2:48 AM ADO.NET Related
    Friday, March 30, 2018 11:06 PM

All replies

  • Hi Peggy,

    According to your description, your issue is more related about ADO.NET. And this forum is discussing and asking questions about the Windows Form and ClickOnce, I will move this thread to corresponding forum: ADO.NET Forum for dedicated information.

    Thank you for your understanding.

    Regards,

    Frankie


    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.

    Monday, April 2, 2018 2:45 AM
  • Hi pchoskw,

    >>I want to know if there is a way around so that I don't have send out a distributed messages asking everyone to update their database file?

    If you don't want to change database fields settings. we need to loop all the fields of datatable and set a default value if there are empty, Or custom a update statement, which does not update the fields  with "AllowZeroLength" = false. 

    Best regards,

    Zhanglong


    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.

    Tuesday, April 3, 2018 2:43 AM
    Moderator