Beispiel #1
0
    public void BindProductsFromLiveServer(DataTable dttblUpdate)
    {
        DataTable dt  = new DataTable("tmp_Updatable");
        string    str = "";

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

                objproduct.DeleteTempProductRecords();

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

                objproduct.InsertUpdateProductFromTemp();
                //Response.Write("<br>SQL BULK COPY Insert comepleted<br>");

                //Response.Write("<br>Data transfer completed<br>");
                //Response.Write("<br>End Time ==> " + DateTime.Now + "<br>");
                //Response.Write("<br>Total " + dt.Rows.Count + " records are import.<br>");

                #endregion
            }
            else
            {
                lbltotalerrorcount.Text += "<tr><td colspan=\"6\"><b style=\"color:red;\">No products available on live server.</b></td></tr>";
            }
        }
        catch (Exception ex) { throw ex; }
        finally { dt.Dispose(); dt = null; dttblUpdate.Dispose(); dttblUpdate = null; }
    }