Exemplo n.º 1
0
    public void BindProductsFromLiveServer(DataTable dttblUpdate)
    {
        //DataTable dt = new DataTable("tmp_Inventory");

        DataTable dt = new DataTable("tmp_productImport");

        string str = "";

        try
        {
            dt = dttblUpdate;
            //lbltotalerrorcount.Text = "";
            if (dt != null && dt.Rows.Count > 0)
            {
                #region BULK INSERT

                //objproduct.DeleteTempInventoryRecords();

                //// Copy the DataTable to SQL Server using SqlBulkCopy
                //objproduct.SqlBulkCopyOperationInventory(dt);

                //objproduct.InsertUpdateInventoryFromTemp();

                objproduct.SqlBulkCopyOperationImportProduct(dt);


                #endregion
            }
            else
            {
                lbltotalerrorcount.Text += "<tr><td colspan=\"6\"><b style=\"color:red;\">No products available on live server.</b></td></tr>";
            }

            //Response.Redirect("viewinventory.aspx?flag=csv");
        }
        catch (Exception ex) { throw ex; }
        finally { dt.Dispose(); dt = null; dttblUpdate.Dispose(); dttblUpdate = null; }
    }