C# DataTable Update Multiple Lines

前端 未结 3 1181
春和景丽
春和景丽 2021-01-16 12:29

how can i do multiple update using datatable ?

i found this Update 1 row

my code:

public void ExportCSV(string SQLSyntax, string LeFile, bool         


        
3条回答
  •  时光说笑
    2021-01-16 12:51

    You need to first set the UpdateCommand property on the DataAdapter to the UPDATE statement that will be executed to update a row in the database.

    Then, after updating values in the DataTable, you need to pass it to DataAdapter.Update(). This will then execute the UpdateCommand for each updated row in the DataTable.

    References:

    MSDN - SqlDataAdapter.Update
    MSDN - SqlDataAdapter.UpdateCommand

提交回复
热议问题