Public voidInserttable (DataTable DT,stringTabelname, DataColumnCollection dtcolum) { //string str = configurationmanager.connectionstrings["ConnectionString"]. Connectionstring.tostring (); //declaring a database connectionSqlConnection conn =NewSqlConnection (strconn); Conn. Open (); //declaring SqlBulkCopy, using release of unmanaged Resources using(SqlBulkCopy SQLBC =NewSqlBulkCopy (conn)) { //Volume of data inserted at one timeSqlbc.batchsize = +; //The number of seconds allowed before the operation completes before timing out, if the transaction is not committed, the data is rolled back, and all replicated rows are removed from the target tableSqlbc.bulkcopytimeout = -; //set the Notifyafter property so that the corresponding event is called when each 10,000 data is inserted. Sqlbc.notifyafter =10000; //sqlbc.sqlrowscopied + = new Sqlrowscopiedeventhandler (onsqlrowscopied); //set the table to be written in bulkSqlbc.destinationtablename =Tabelname; //Customize the DataTable and database fields to correspond//SQLBC.COLUMNMAPPINGS.ADD ("id", "tel"); //sqlBC.ColumnMappings.Add ("name", "Neirong"); for(inti =0; i < Dtcolum.count; i++) {sqlBC.ColumnMappings.Add (Dtcolum[i]. Columnname.tostring (), Dtcolum[i]. Columnname.tostring ()); } //Bulk Writesqlbc.writetoserver (DT); } conn. Dispose (); } //Response-Time Events voidOnsqlrowscopied (Objectsender, Sqlrowscopiedeventargs e) { //Response.Write ("<br/> ok!");}