You must Sign In to post a response.
  • Category: LINQ

    Update sql table from dynamic table

    I have Dynamic Table created from Excel
    DataTable dt = ExcelToTable(path);

    dt has columns
    1. Updated_Supplier_Remark

    other table is tblExportOrderdatas with Columns
    1. Supplier_Remark

    I want to update Supplier_Remark with Updated_Supplier_Remark and Date with Updated_Date

    How can i update data from dt to tblExportOrderdatas using LINQ only.

    I am able to do it Using Sql Query but need to do it by Linq only

    Below code is not saving data. Please suggest.

    int sid=Convert.ToInt32(sExportID);

    var objtblInbox = (from m in objLCSEntities.tblExportOrderdatas
    where m.Batch_ID == sid
    select m).ToList<tblExportOrderdata>();

    foreach (var p in objtblInbox)

    var nflplayer = new tblExportOrderdata();
    foreach (DataRow dr in copydt.Rows) // search whole table
    if (!string.IsNullOrEmpty(dr["Updated_Supplier_Remarks"].ToString())) // if not empty

    nflplayer.Supplier_Remark = dr["Updated_Supplier_Remarks"].ToString();


  • #769831
    You can refer the below post. hope this help you that you are looking for.

  • Sign In to post your comments